Repository navigation
Description
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
eslintas a peer dependency and uses ESLint flat config with@typescript-eslint/prefer-readonly-parameter-typesenabled. - 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
- Open any TypeScript file in this project under opencode.
- Tail the latest
/devvol/data/opencode/log/*.logand observecount=0 textDocument/publishDiagnosticsfor theeslintserverID whilemise run lintreports a warning on the same file. - For Bug 2 evidence specifically, wrap the
eslint.commandwith a stdin/stdout-teeing script and inspect the captured messages — you will see the server advertisediagnosticProviderand sendworkspace/diagnostic/refresh, which opencode answers with-32601.
Related upstream issues
anomalyco/opencode#6365— ESLint LSP server fails to auto-install (samenpm installcode 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=devinside any subpackage that declares its owndependencies(thevscode-eslintrepo has separateclient/,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
initializetimeout (currently hardcoded at 45 s) configurable, and log server stderr so failure modes likeMODULE_NOT_FOUNDare not silently swallowed.
Bug 2
- Implement LSP 3.17 pull-model diagnostics in the LSP client:
- Declare
textDocument.diagnosticclient capability ininitialize. - When a server's
initializeresult advertisesdiagnosticProvider, calltextDocument/diagnosticondidOpen/didChangeand route the returned items through the same channel as push-modelpublishDiagnostics. - Handle
workspace/diagnostic/refreshby invalidating the cache and re-pulling for all open documents that were served by that LSP.
- Declare
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
github-actions commentedon Apr 23, 2026
This issue might be related to existing issues. Please check:
npm installcode path inlsp/server.ts, though Windows-specific root cause)If none of these cover your specific case (missing
server/node_modulesafter auto-install), this issue can stand on its own.github-actions commentedon Jul 3, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.