Skip to content

ESLint LSP fails to load #23911

Closed as not planned
Closed as not planned

Description

@Duncan3142

ESLint LSP diagnostics never surface in opencode

Summary

With an eslint dependency in the project, opencode's TUI reports the ESLint LSP as loaded but the agent never sees any ESLint diagnostics — even ones that mise run lint and the VS Code dbaeumer.vscode-eslint extension both report on the same file. Investigation revealed two distinct bugs. The second is the blocker: opencode's LSP client does not implement LSP 3.17 pull-model diagnostics, which is the only mode the current vscode-eslint server (v3.x) uses.

Environment

  • opencode: 1.14.20 (from /devvol/data/mise/installs/github-anomalyco-opencode/1.14.20/opencode)
  • Node: 24.15.0
  • OS: Linux (devcontainer)
  • Project has eslint as a peer dependency and uses ESLint flat config with @typescript-eslint/prefer-readonly-parameter-types enabled.
  • Visible in VS Code and mise run lint: src/bin/cli.ts:19:18 warning Parameter should be a read only type (@typescript-eslint/prefer-readonly-parameter-types).

Expected behaviour

opencode spawns the ESLint language server, it initialises successfully, and ESLint diagnostics (matching what VS Code's dbaeumer.vscode-eslint extension and eslint CLI report) are exposed to the LLM.

Actual behaviour

No ESLint diagnostics are ever surfaced to the agent. The LSP client lifecycle completes without error, but every publishDiagnostics has count=0.

Bug 1 — auto-installed vscode-eslint is missing its server runtime dependencies

Observation

When opencode first detects eslint it downloads the dbaeumer/vscode-eslint repo to /devvol/cache/opencode/bin/vscode-eslint/ and spawns server/out/eslintServer.js. That script's first line requires vscode-languageserver/node, which is declared in server/package.json but never installed by opencode. The parent node_modules/ only contains the extension's dev/build deps (webpack, chalk, acorn, …). server/node_modules/ does not exist.

Evidence

$ node /devvol/cache/opencode/bin/vscode-eslint/server/out/eslintServer.js --stdio </dev/null
Error: Cannot find module 'vscode-languageserver/node'
  at Object.<anonymous> (.../server/out/eslintServer.js:45:16)
Node.js v24.15.0

Opencode's log then shows:

service=lsp.server spawning eslint server
service=lsp.client serverID=eslint sending initialize
ERROR service=lsp.client serverID=eslint error=Operation timed out after 45000ms initialize error
ERROR service=lsp error=LSPInitializeError Caused by: Operation timed out after 45000ms Failed to initialize LSP client eslint
service=lsp.client serverID=eslint path=/workspace/src/bin/cli.ts count=0 textDocument/publishDiagnostics

The server process dies immediately on require; opencode hangs for the full 45 s initialize timeout, then the TUI reports the LSP as inactive.

Workaround (for Bug 1 only)

Redirect opencode at a server with its deps bundled — e.g. the dbaeumer.vscode-eslint VS Code extension's webpacked build — via opencode.jsonc:

"lsp": {
  "eslint": {
    "command": [
      "node",
      "/root/.vscode-server/extensions/dbaeumer.vscode-eslint-3.0.24/server/out/eslintServer.js",
      "--stdio"
    ]
  }
}

This unblocks initialisation (observed: 26 ms init instead of 45 s timeout) but does not solve Bug 2.

Bug 2 — opencode's LSP client does not implement pull-model diagnostics

Observation

Even with the VS Code server booting cleanly, every publishDiagnostics still reports count=0. Tracing the LSP traffic via a stdin/stdout-teeing wrapper reveals why.

Evidence

Server's initialize response advertises pull-model diagnostics:

{
  "capabilities": {
    "textDocumentSync": { "openClose": true, "change": 2, "willSaveWaitUntil": false, "save": { "includeText": false } },
    "workspace": { "workspaceFolders": { "supported": true } },
    "executeCommandProvider": { "commands": [/* ... */] },
    "diagnosticProvider": {
      "identifier": "eslint",
      "interFileDependencies": false,
      "workspaceDiagnostics": false
    }
  }
}

After textDocument/didOpen, the server sends workspace/diagnostic/refresh (the client's cue to pull). opencode answers method-not-found:

server → opencode : workspace/diagnostic/refresh
opencode → server : {"jsonrpc":"2.0","id":0,"error":{"code":-32601,"message":"Unhandled method workspace/diagnostic/refresh"}}
server → opencode : logMessage "Failed to refresh diagnostics"

opencode never issues textDocument/diagnostic requests, and its initialize client capabilities object omits the textDocument.diagnostic feature. The server therefore never produces diagnostics via push or pull, so opencode receives none.

Root cause

The vscode-eslint 3.x server exclusively uses the LSP 3.17 pull-diagnostic protocol. opencode's LSP client supports only the legacy push-model textDocument/publishDiagnostics. The two never meet. Neither initializationOptions nor workspace/didChangeConfiguration can bridge the gap — those settings are only consulted when the server handles a pull request that never comes.

Reproduction

  1. Open any TypeScript file in this project under opencode.
  2. Tail the latest /devvol/data/opencode/log/*.log and observe count=0 textDocument/publishDiagnostics for the eslint serverID while mise run lint reports a warning on the same file.
  3. For Bug 2 evidence specifically, wrap the eslint.command with a stdin/stdout-teeing script and inspect the captured messages — you will see the server advertise diagnosticProvider and send workspace/diagnostic/refresh, which opencode answers with -32601.

Related upstream issues

  • anomalyco/opencode#6365 — ESLint LSP server fails to auto-install (same npm install code path).
  • anomalyco/opencode#13272 — ESLint LSP initializes but diagnostics timeout with empty result. Matches Bug 2 exactly.
  • anomalyco/opencode#20824 — LSP server spawn hangs indefinitely on failed install. Matches Bug 1's 45 s hang.

Suggested fixes upstream

Bug 1

  • Run npm install --omit=dev inside any subpackage that declares its own dependencies (the vscode-eslint repo has separate client/, server/, and root packages).
  • Alternatively, install the published VSIX's webpacked server, which has its dependencies inlined and needs no post-install step.
  • Make the LSP initialize timeout (currently hardcoded at 45 s) configurable, and log server stderr so failure modes like MODULE_NOT_FOUND are not silently swallowed.

Bug 2

  • Implement LSP 3.17 pull-model diagnostics in the LSP client:
    • Declare textDocument.diagnostic client capability in initialize.
    • When a server's initialize result advertises diagnosticProvider, call textDocument/diagnostic on didOpen/didChange and route the returned items through the same channel as push-model publishDiagnostics.
    • Handle workspace/diagnostic/refresh by invalidating the cache and re-pulling for all open documents that were served by that LSP.

Status in this repo

Left opencode.jsonc at "lsp": true. No workaround is applied. mise run lint + the VS Code ESLint extension remain the channels by which ESLint findings are produced; the opencode agent does not see them. This note will be revisited once the upstream fixes for #13272 (and/or #6365, #20824) land.

Activity

  1. added
    bug
    on Apr 23, 2026
  2. added
    core
    on Apr 23, 2026
  3. github-actions commented on Apr 23, 2026

    @github-actions
    Contributor

    This issue might be related to existing issues. Please check:

    If none of these cover your specific case (missing server/node_modules after auto-install), this issue can stand on its own.

  4. removed
    bug
    core
    on May 3, 2026
  5. github-actions commented on Jul 3, 2026

    @github-actions
    Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions