GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Dart LSP fails on Windows: 'Command not found' despite dart being in PATH · Issue #6861 · anomalyco/opencode

Dart LSP fails on Windows: 'Command not found' despite dart being in PATH #6861

New issue
Copy link
New issue
Copy link
Closed
Closed
Dart LSP fails on Windows: 'Command not found' despite dart being in PATH#6861
Copy link
Assignees
rekram1-node
Labels
windows

Description

@ravergurl
ravergurl
opened on Jan 4, 2026
Issue body actions

Description

The Dart LSP integration fails on Windows with "Command not found: dart" even when:

  1. dart is correctly installed and in PATH
  2. Bun.which('dart') returns a valid executable path
  3. The executable can be spawned successfully

Environment

  • OS: Windows 10/11
  • opencode version: 1.1.1
  • Dart SDK: 3.5.4

Steps to Reproduce

  1. Install Dart SDK on Windows (via Flutter or standalone)
  2. Verify dart --version works in terminal
  3. Run lsp_diagnostics on any .dart file

Expected Behavior

Dart LSP server starts and returns diagnostics.

Actual Behavior

Error: LSP server 'dart' is configured but NOT INSTALLED.

Command not found: dart

To install:
  Included with Dart SDK

Investigation Findings

Verification that dart works:

# Bun.which finds dart correctly
bun -e "console.log(Bun.which('dart'))"
# Output: C:\Users\peopl\bin\dart.exe

# dart runs fine
dart --version
# Output: Dart SDK version: 3.5.4

# Language server works
dart language-server --help
# Output: (help text displayed)

# Spawn without shell works
bun -e "const {spawn} = require('child_process'); const p = spawn(Bun.which('dart'), ['--version']); p.stdout.on('data', d => console.log(d.toString()))"
# Output: Dart SDK version: 3.5.4

Config override doesn't help:

Added to ~/.config/opencode/opencode.jsonc:

"lsp": {
  "dart": {
    "command": ["cmd.exe", "/c", "C:\Users\peopl\bin\dart.exe", "language-server", "--lsp"],
    "extensions": [".dart"]
  }
}

The LSP still reports "Command not found" - the config command override is being ignored during the availability check.

Root Cause Analysis

The issue appears to be in packages/opencode/src/lsp/server.ts. The Dart LSP config does:

export const Dart: Info = {
  id: "dart",
  extensions: [".dart"],
  root: NearestRoot(["pubspec.yaml", "analysis_options.yaml"]),
  async spawn(root) {
    const dart = Bun.which("dart")
    if (!dart) {
      log.info("dart not found, please install dart first")
      return
    }
    return {
      process: spawn(dart, ["language-server", "--lsp"], {
        cwd: root,
      }),
    }
  },
}

Two issues:

  1. The "installed" check happens before config command override is applied
  2. Even when Bun.which("dart") succeeds, something in the availability check fails

Proposed Fix

Option 1: Add shell: true for Windows:

process: spawn(dart, ["language-server", "--lsp"], {
  cwd: root,
  shell: process.platform === "win32",
}),

Option 2: Respect config command override during availability check - if user provides a custom command in config, skip the Bun.which check.

Related

  • PR core: add built-in Dart LSP server and formatter #4841 added Dart LSP support but didn't handle Windows-specific spawn issues
  • This is similar to issues with .cmd files on Windows requiring shell: true

Activity

  1. github-actions
    assigned
    rekram1-node
    on Jan 4, 2026
  2. github-actions
    added
    windows
    on Jan 4, 2026
  3. ravergurl
    added a commit that references this issue on Jan 4, 2026

    fix(lsp): add shell option for Dart LSP on Windows

    This issue will close once commit 96405e1 is merged into the 'dev' branch.
    96405e1
  4. github-actions commented on Mar 25, 2026

    @github-actions
    github-actionsBot
    on Mar 25, 2026 – with GitHub Actions
    Contributor
    More actions

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

  5. Hona commented on Apr 23, 2026

    @Hona
    Hona
    on Apr 23, 2026
    Member
    More actions

    Please try this in the latest version - I tried and dart reports correctly LSP errors in a file

    i installed with choco install dart-sdk

    Image
  6. Hona
    closed this as completedon Apr 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @rekram1-node
    rekram1-node

Labels

windows

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.