You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
LSP server spawn hangs indefinitely when download/build fails, blocking all file tools #20824
When an LSP server's spawn() function downloads or builds external resources (e.g., ESLint fetching vscode-eslint from GitHub, ElixirLS building from source), the operation has no timeout. If the network is blocked, slow, or the build hangs, the spawn promise stays pending forever.
This promise is stored in the spawning Map inside getClients() (lsp/index.ts). Every subsequent call to getClients() for the same server extension awaits this inflight promise indefinitely:
Since getClients() is called by touchFile(), which runs after every Write and Edit tool execution, all file-modifying tools hang in "running" state permanently.
Steps to Reproduce
Run OpenCode in a container environment where outbound access to GitHub is blocked or extremely slow
Have a project with eslint in node_modules (triggers ESLint LSP auto-spawn)
ESLint LSP spawn attempts fetch("https://github.com/microsoft/vscode-eslint/archive/refs/heads/main.zip") — this never completes
Use the Write or Edit tool on any file
The tool writes the file successfully but never returns completion — stuck at LSP.touchFile() → getClients() → await inflight
Observed Behavior
Log shows spawning eslint server and downloading and building VS Code ESLint server but never installed VS Code ESLint server or any error
The opencode/bin/ directory remains empty (download never completed)
All subsequent Write/Edit tool calls hang indefinitely
The tool status shows "running" forever in the UI
The file content IS written successfully — the hang occurs in the post-write LSP diagnostics step
Expected Behavior
The spawn should time out after a reasonable period, mark the server as broken, and allow subsequent tool calls to proceed without LSP diagnostics for that server.
Affected LSP Servers
All servers that download or build external resources: ESLint, ElixirLS, Zls, Gopls, CSharp, FSharp, Rubocop, Clangd, JDTLS, Kotlin-LS, Lua-LS, Terraform-LS, Texlab, Tinymist.
If these don't fully cover your specific scenario (no-timeout on the initial download/build phase), it may be worth referencing them in this issue for context.
permission=edit pattern=shared/src/<file-a>.ts allow
format file=...\shared\src\<file-a>.ts formatting
lsp file=...\shared\src\<file-a>.ts touching file
lsp serverID=typescript root=...\<monorepo>\shared spawned lsp server
lsp.client serverID=typescript initialized
← NO FURTHER LOG LINES (8+ min)
Expected
After lsp.client … initialized, session should continue (session.prompt next step, tool completion, or diagnostics timeout) without blocking the TUI event loop.
Actual
Process hangs indefinitely after initialized; no ERROR line in log.
Workaround
Global "lsp": false or "typescript": { "disabled": true } → no freeze on same workflow.
Re-enabling TypeScript LSP → freeze returns.
Hypothesis
Matches this issue: post-tool LSP.touchFile() → getClients() awaits spawn/diagnostics without effective timeout on Windows + Bun, blocking the main loop after initialize completes.
Possibly aggravated by:
LSP root = monorepo shared/ subfolder (not repo root) while parent session works at monorepo root.
Activity
github-actions commentedon Apr 3, 2026
This issue might be a duplicate of existing issues. Please check:
apply_patchwaits for LSPs sequentially causing hang — related: file tools blocking indefinitely on LSP operationslsp_diagnosticshangs with nixd — related: indefinite hang waiting on LSP responseIf these don't fully cover your specific scenario (no-timeout on the initial download/build phase), it may be worth referencing them in this issue for context.
chrythjin commentedon May 17, 2026
Repro: Windows — TUI zombie after
read/edit+ TypeScript LSPtouchFile(1.15.3, Bun)Related: #125, #20824, #10965, #20835
Environment
[email protected], Bun 1.3.13 embedded inopencode.exe)typescript-language-servershared/subfolder (not repo root)typescript-language-serverenabled;biomeand other LSPs explicitlydisabledOPENCODE_EXPERIMENTAL_LSP_DIAGNOSTICS_TIMEOUT_MS=15000(when set; freeze still occurs)oh-my-openagent,@plannotator/opencode,@cortexkit/opencode-magic-context(no Historian child sessions during freeze)Minimal
opencode.jsonLSP block:Symptom
opencode.exeprocess shows Responding: True (~300–800 MB WS).Ctrl+Coften does not recover;Stop-Process -Forcerequired."lsp": falsein global config stops the freezes (local workaround).Steps to reproduce
shared/package.jsonand.tssources undershared/src/.opencode)./start-work→ spawns a subagent onopenai-oauth/gpt-5.4-mini-xhigh).readon multiple files undershared/src/in quick succession, orediton a.tsfile there (format runs after edit).Observed behavior (two variants, same hang point)
Variant A —
read(3 files):Variant B —
edit+ format:Expected
After
lsp.client … initialized, session should continue (session.promptnext step, tool completion, or diagnostics timeout) without blocking the TUI event loop.Actual
Process hangs indefinitely after
initialized; no ERROR line in log.Workaround
"lsp": falseor"typescript": { "disabled": true }→ no freeze on same workflow.Hypothesis
Matches this issue: post-tool
LSP.touchFile()→getClients()awaits spawn/diagnostics without effective timeout on Windows + Bun, blocking the main loop afterinitializecompletes.Possibly aggravated by:
shared/subfolder (not repo root) while parent session works at monorepo root.touchFilecalls in one tool batch (bug: apply_patch waits for LSPs sequentially causing big multi-file patches to hang #10965 sequential touch pattern).Happy to provide redacted full log tail or test with
opencode scrap <file.ts> --print-logsif useful.github-actions commentedon Jul 17, 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.