Process hangs when trying to read TypeScript file #75

Closed
opened 2026-02-16 17:25:05 -05:00 by yindo · 7 comments
Owner

Originally created by @cschmatzler on GitHub (Jun 15, 2025).

Originally assigned to: @thdxr on GitHub.

Not sure if it's my setup, but OpenCode hangs (and doesn't allow closing with Ctrl-C, needing a pkill) when trying to read a TypeScript file, presumingly because starting the LSP fails.

Image

The full logs:

2025-06-15T16:49:33 +22ms service=default version=0.1.49 args=--print-logs opencode
2025-06-15T16:49:33 +0ms service=app cwd=/Users/christoph/Development/personal/shnosh creating
2025-06-15T16:49:33 +2ms service=app git=/Users/christoph/Development/personal/shnosh git
2025-06-15T16:49:33 +1ms service=app name=provider registering service
2025-06-15T16:49:33 +0ms service=app name=config registering service
2025-06-15T16:49:33 +0ms service=config loaded
2025-06-15T16:49:33 +1ms service=models.dev refreshing
2025-06-15T16:49:33 +0ms service=provider loading
2025-06-15T16:49:34 +580ms service=provider providerID=amazon-bedrock loaded
2025-06-15T16:49:34 +1ms service=provider providerID=anthropic loaded
2025-06-15T16:49:34 +0ms service=app name=share registering service
2025-06-15T16:49:34 +0ms service=bus type=storage.write subscribing
2025-06-15T16:49:34 +0ms service=app name=bus registering service
2025-06-15T16:49:34 +37ms service=server method=POST path=/path_get request
2025-06-15T16:49:34 +1ms service=server duration=1 response
2025-06-15T16:49:34 +0ms service=server method=POST path=/app_info request
2025-06-15T16:49:34 +0ms service=server duration=0 response
2025-06-15T16:49:34 +0ms service=server method=POST path=/provider_list request
2025-06-15T16:49:34 +1ms service=server duration=1 response
2025-06-15T16:49:34 +1ms service=server method=POST path=/file_search request
2025-06-15T16:49:34 +1ms service=fzf filepath=/Users/christoph/.local/share/mise/installs/aqua-junegunn-fzf/0.62.0/fzf found
2025-06-15T16:49:34 +13ms service=fzf count=0 results
2025-06-15T16:49:34 +0ms service=server duration=14 response
2025-06-15T16:49:34 +1ms service=server method=GET path=/event request
2025-06-15T16:49:34 +0ms service=server event connected
2025-06-15T16:49:34 +1ms service=bus type=* subscribing
2025-06-15T16:49:34 +1ms service=server duration=2 response
2025-06-15T16:49:42 +7847ms service=server method=POST path=/session_create request
2025-06-15T16:49:42 +1ms service=session id=ses_88b80cec7ffe2a8e907683cbd6 title=New Session - 2025-06-15T16:49:42.200Z time=[object Object] created
2025-06-15T16:49:42 +0ms service=app name=session registering service
2025-06-15T16:49:42 +0ms service=app name=storage registering service
2025-06-15T16:49:42 +0ms service=storage path=/Users/christoph/.local/share/opencode/project/-Users-christoph-Development-personal-shnosh/storage init
2025-06-15T16:49:42 +1ms service=bus type=storage.write publishing
2025-06-15T16:49:42 +0ms service=bus type=session.updated publishing
2025-06-15T16:49:42 +0ms service=server duration=1 response
2025-06-15T16:49:42 +0ms service=server method=POST path=/session_chat request
2025-06-15T16:49:42 +2ms service=session session=ses_88b80cec7ffe2a8e907683cbd6 chatting
2025-06-15T16:49:42 +0ms service=provider providerID=anthropic modelID=claude-sonnet-4-20250514 loading
2025-06-15T16:49:42 +0ms service=models.dev fetching ai-sdk
2025-06-15T16:49:42 +3ms service=server method=POST path=/session_messages request
2025-06-15T16:49:42 +1ms service=server duration=1 response
2025-06-15T16:49:42 +123ms service=models.dev found ai-sdk
2025-06-15T16:49:42 +30ms service=provider providerID=anthropic modelID=claude-sonnet-4-20250514 found
2025-06-15T16:49:42 +2ms service=session sessionID=ses_88b80cec7ffe2a8e907683cbd6 locking
2025-06-15T16:49:42 +6ms service=bus type=storage.write publishing
2025-06-15T16:49:42 +0ms service=bus type=message.updated publishing
2025-06-15T16:49:42 +425ms service=bus type=storage.write publishing
2025-06-15T16:49:42 +0ms service=bus type=message.updated publishing
2025-06-15T16:49:42 +0ms service=app name=mcp registering service
2025-06-15T16:49:44 +1635ms service=bus type=storage.write publishing
2025-06-15T16:49:44 +0ms service=bus type=session.updated publishing
2025-06-15T16:49:45 +1130ms service=session session=ses_88b80cec7ffe2a8e907683cbd6 type=step-start part
2025-06-15T16:49:45 +2ms service=bus type=storage.write publishing
2025-06-15T16:49:45 +0ms service=bus type=message.updated publishing
2025-06-15T16:49:45 +1ms service=session session=ses_88b80cec7ffe2a8e907683cbd6 type=text-delta part
2025-06-15T16:49:45 +1ms service=bus type=storage.write publishing
2025-06-15T16:49:45 +0ms service=bus type=message.updated publishing
[truncated tool calls here]
2025-06-15T16:49:57 +0ms service=bus type=message.part.updated publishing
2025-06-15T16:49:57 +0ms service=bus type=storage.write publishing
2025-06-15T16:49:57 +0ms service=bus type=message.updated publishing
2025-06-15T16:49:57 +3ms service=lsp.client id=typescript starting client

Using mise for managing runtimes, my mise.toml is this:

[tools]
node = "23.11.1"
bun = "1.2.16"

[env]
_.path = ["node_modules/.bin"]

Generally, my LSP is managed by mason-lspconfig in nvim, so there's a chance OpenCode just doesn't find it in ~/.local/share/nvim. In which case it should still not just hang.

Originally created by @cschmatzler on GitHub (Jun 15, 2025). Originally assigned to: @thdxr on GitHub. Not sure if it's my setup, but OpenCode hangs (and doesn't allow closing with Ctrl-C, needing a pkill) when trying to read a TypeScript file, presumingly because starting the LSP fails. ![Image](https://github.com/user-attachments/assets/83b08418-4d2e-48f0-8ad4-65b7d119a3d1) The full logs: ``` 2025-06-15T16:49:33 +22ms service=default version=0.1.49 args=--print-logs opencode 2025-06-15T16:49:33 +0ms service=app cwd=/Users/christoph/Development/personal/shnosh creating 2025-06-15T16:49:33 +2ms service=app git=/Users/christoph/Development/personal/shnosh git 2025-06-15T16:49:33 +1ms service=app name=provider registering service 2025-06-15T16:49:33 +0ms service=app name=config registering service 2025-06-15T16:49:33 +0ms service=config loaded 2025-06-15T16:49:33 +1ms service=models.dev refreshing 2025-06-15T16:49:33 +0ms service=provider loading 2025-06-15T16:49:34 +580ms service=provider providerID=amazon-bedrock loaded 2025-06-15T16:49:34 +1ms service=provider providerID=anthropic loaded 2025-06-15T16:49:34 +0ms service=app name=share registering service 2025-06-15T16:49:34 +0ms service=bus type=storage.write subscribing 2025-06-15T16:49:34 +0ms service=app name=bus registering service 2025-06-15T16:49:34 +37ms service=server method=POST path=/path_get request 2025-06-15T16:49:34 +1ms service=server duration=1 response 2025-06-15T16:49:34 +0ms service=server method=POST path=/app_info request 2025-06-15T16:49:34 +0ms service=server duration=0 response 2025-06-15T16:49:34 +0ms service=server method=POST path=/provider_list request 2025-06-15T16:49:34 +1ms service=server duration=1 response 2025-06-15T16:49:34 +1ms service=server method=POST path=/file_search request 2025-06-15T16:49:34 +1ms service=fzf filepath=/Users/christoph/.local/share/mise/installs/aqua-junegunn-fzf/0.62.0/fzf found 2025-06-15T16:49:34 +13ms service=fzf count=0 results 2025-06-15T16:49:34 +0ms service=server duration=14 response 2025-06-15T16:49:34 +1ms service=server method=GET path=/event request 2025-06-15T16:49:34 +0ms service=server event connected 2025-06-15T16:49:34 +1ms service=bus type=* subscribing 2025-06-15T16:49:34 +1ms service=server duration=2 response 2025-06-15T16:49:42 +7847ms service=server method=POST path=/session_create request 2025-06-15T16:49:42 +1ms service=session id=ses_88b80cec7ffe2a8e907683cbd6 title=New Session - 2025-06-15T16:49:42.200Z time=[object Object] created 2025-06-15T16:49:42 +0ms service=app name=session registering service 2025-06-15T16:49:42 +0ms service=app name=storage registering service 2025-06-15T16:49:42 +0ms service=storage path=/Users/christoph/.local/share/opencode/project/-Users-christoph-Development-personal-shnosh/storage init 2025-06-15T16:49:42 +1ms service=bus type=storage.write publishing 2025-06-15T16:49:42 +0ms service=bus type=session.updated publishing 2025-06-15T16:49:42 +0ms service=server duration=1 response 2025-06-15T16:49:42 +0ms service=server method=POST path=/session_chat request 2025-06-15T16:49:42 +2ms service=session session=ses_88b80cec7ffe2a8e907683cbd6 chatting 2025-06-15T16:49:42 +0ms service=provider providerID=anthropic modelID=claude-sonnet-4-20250514 loading 2025-06-15T16:49:42 +0ms service=models.dev fetching ai-sdk 2025-06-15T16:49:42 +3ms service=server method=POST path=/session_messages request 2025-06-15T16:49:42 +1ms service=server duration=1 response 2025-06-15T16:49:42 +123ms service=models.dev found ai-sdk 2025-06-15T16:49:42 +30ms service=provider providerID=anthropic modelID=claude-sonnet-4-20250514 found 2025-06-15T16:49:42 +2ms service=session sessionID=ses_88b80cec7ffe2a8e907683cbd6 locking 2025-06-15T16:49:42 +6ms service=bus type=storage.write publishing 2025-06-15T16:49:42 +0ms service=bus type=message.updated publishing 2025-06-15T16:49:42 +425ms service=bus type=storage.write publishing 2025-06-15T16:49:42 +0ms service=bus type=message.updated publishing 2025-06-15T16:49:42 +0ms service=app name=mcp registering service 2025-06-15T16:49:44 +1635ms service=bus type=storage.write publishing 2025-06-15T16:49:44 +0ms service=bus type=session.updated publishing 2025-06-15T16:49:45 +1130ms service=session session=ses_88b80cec7ffe2a8e907683cbd6 type=step-start part 2025-06-15T16:49:45 +2ms service=bus type=storage.write publishing 2025-06-15T16:49:45 +0ms service=bus type=message.updated publishing 2025-06-15T16:49:45 +1ms service=session session=ses_88b80cec7ffe2a8e907683cbd6 type=text-delta part 2025-06-15T16:49:45 +1ms service=bus type=storage.write publishing 2025-06-15T16:49:45 +0ms service=bus type=message.updated publishing [truncated tool calls here] 2025-06-15T16:49:57 +0ms service=bus type=message.part.updated publishing 2025-06-15T16:49:57 +0ms service=bus type=storage.write publishing 2025-06-15T16:49:57 +0ms service=bus type=message.updated publishing 2025-06-15T16:49:57 +3ms service=lsp.client id=typescript starting client ``` Using [mise](https://mise.jdx.dev) for managing runtimes, my `mise.toml` is this: ``` [tools] node = "23.11.1" bun = "1.2.16" [env] _.path = ["node_modules/.bin"] ``` Generally, my LSP is managed by mason-lspconfig in nvim, so there's a chance OpenCode just doesn't find it in `~/.local/share/nvim`. In which case it should still not just hang.
yindo closed this issue 2026-02-16 17:25:05 -05:00
Author
Owner

@cschmatzler commented on GitHub (Jun 15, 2025):

Here's a share, if that helps at all https://dev.opencode.ai/s/ee411617

@cschmatzler commented on GitHub (Jun 15, 2025): Here's a share, if that helps at all https://dev.opencode.ai/s/ee411617
Author
Owner

@thdxr commented on GitHub (Jun 15, 2025):

we have a hidden debug command that i've been using to test diagnostics - can you show me the output of opencode scrap ./some/typescript/file.ts --print-logs

@thdxr commented on GitHub (Jun 15, 2025): we have a hidden debug command that i've been using to test diagnostics - can you show me the output of `opencode scrap ./some/typescript/file.ts --print-logs`
Author
Owner

@cschmatzler commented on GitHub (Jun 15, 2025):

Basically the same as the other logs:

❯ opencode scrap ./packages/web/src/common/cn.ts --print-logs
2025-06-15T17:41:45 +26ms service=default version=0.1.49 args=scrap,./packages/web/src/common/cn.ts,--print-logs opencode
2025-06-15T17:41:45 +0ms service=app cwd=/Users/christoph/Development/personal/shnosh creating
2025-06-15T17:41:45 +3ms service=app git=/Users/christoph/Development/personal/shnosh git
2025-06-15T17:41:45 +1ms service=app name=lsp registering service
2025-06-15T17:41:45 +0ms service=lsp initializing
2025-06-15T17:41:45 +2ms service=lsp.client id=typescript starting client

Then the process never exits.

@cschmatzler commented on GitHub (Jun 15, 2025): Basically the same as the other logs: ``` ❯ opencode scrap ./packages/web/src/common/cn.ts --print-logs 2025-06-15T17:41:45 +26ms service=default version=0.1.49 args=scrap,./packages/web/src/common/cn.ts,--print-logs opencode 2025-06-15T17:41:45 +0ms service=app cwd=/Users/christoph/Development/personal/shnosh creating 2025-06-15T17:41:45 +3ms service=app git=/Users/christoph/Development/personal/shnosh git 2025-06-15T17:41:45 +1ms service=app name=lsp registering service 2025-06-15T17:41:45 +0ms service=lsp initializing 2025-06-15T17:41:45 +2ms service=lsp.client id=typescript starting client ``` Then the process never exits.
Author
Owner

@thdxr commented on GitHub (Jun 15, 2025):

while it's hanging do you see this

thdxr@romulus ~/dev/projects/sst/opencode$ ps aux | grep "opencode x"                                                                                                                                                                                                                                                                                ✹dev
thdxr    4110975  0.0  0.0 1153600 10632 pts/23  S+   13:50   0:00 /home/thdxr/.bun/install/global/node_modules/opencode-linux-x64/bin/opencode x typescript-language-server --stdio

btw i added a workaround for the freezing error in v0.1.51 but it doesn't fix the underlying issue of your lsp server not working

@thdxr commented on GitHub (Jun 15, 2025): while it's hanging do you see this ``` thdxr@romulus ~/dev/projects/sst/opencode$ ps aux | grep "opencode x" ✹dev thdxr 4110975 0.0 0.0 1153600 10632 pts/23 S+ 13:50 0:00 /home/thdxr/.bun/install/global/node_modules/opencode-linux-x64/bin/opencode x typescript-language-server --stdio ``` btw i added a workaround for the freezing error in v0.1.51 but it doesn't fix the underlying issue of your lsp server not working
Author
Owner

@cschmatzler commented on GitHub (Jun 15, 2025):

There's no running process, nope.

❯ ps aux | grep "opencode x"
christoph        49346   0.0  0.0 435300544   1392 s005  R+    8:18PM   0:00.00 grep --color=auto opencode x

Can confirm though that on 0.1.51 it's now at least exiting correctly

❯ opencode scrap ./packages/web/src/common/cn.ts --print-logs
2025-06-15T18:17:19 +27ms service=default version=0.1.51 args=scrap,./packages/web/src/common/cn.ts,--print-logs opencode
2025-06-15T18:17:19 +1ms service=app cwd=/Users/christoph/Development/personal/shnosh creating
2025-06-15T18:17:19 +1ms service=app git=/Users/christoph/Development/personal/shnosh git
2025-06-15T18:17:19 +2ms service=app name=lsp registering service
2025-06-15T18:17:19 +0ms service=lsp initializing
2025-06-15T18:17:19 +3ms service=lsp.client id=typescript starting client
2025-06-15T18:17:19 +0ms service=lsp.client id=typescript sending initialize
2025-06-15T18:17:24 +5003ms serverID=typescript LSPInitializeError
{}
2025-06-15T18:17:24 +3ms service=app name=lsp shutdown
@cschmatzler commented on GitHub (Jun 15, 2025): There's no running process, nope. ``` ❯ ps aux | grep "opencode x" christoph 49346 0.0 0.0 435300544 1392 s005 R+ 8:18PM 0:00.00 grep --color=auto opencode x ``` Can confirm though that on 0.1.51 it's now at least exiting correctly ``` ❯ opencode scrap ./packages/web/src/common/cn.ts --print-logs 2025-06-15T18:17:19 +27ms service=default version=0.1.51 args=scrap,./packages/web/src/common/cn.ts,--print-logs opencode 2025-06-15T18:17:19 +1ms service=app cwd=/Users/christoph/Development/personal/shnosh creating 2025-06-15T18:17:19 +1ms service=app git=/Users/christoph/Development/personal/shnosh git 2025-06-15T18:17:19 +2ms service=app name=lsp registering service 2025-06-15T18:17:19 +0ms service=lsp initializing 2025-06-15T18:17:19 +3ms service=lsp.client id=typescript starting client 2025-06-15T18:17:19 +0ms service=lsp.client id=typescript sending initialize 2025-06-15T18:17:24 +5003ms serverID=typescript LSPInitializeError {} 2025-06-15T18:17:24 +3ms service=app name=lsp shutdown ```
Author
Owner

@thdxr commented on GitHub (Jun 16, 2025):

what happens if you do BUN_BE_BUN=1 opencode x typescript-language-server

@thdxr commented on GitHub (Jun 16, 2025): what happens if you do `BUN_BE_BUN=1 opencode x typescript-language-server`
Author
Owner

@cschmatzler commented on GitHub (Jun 16, 2025):

Ohhhhh.

❮ BUN_BE_BUN=1 opencode x typescript-language-server
mise ERROR No version is set for shim: typescript-language-server
Set a global default version with one of the following:
mise use -g npm:typescript-language-server@4.3.4
mise ERROR Run with --verbose or MISE_VERBOSE=1 for more information

So somehow mise's shims get in the way. Installing typescript-language-server via mise actually makes it work and opencode finds and starts it as well.

@cschmatzler commented on GitHub (Jun 16, 2025): Ohhhhh. ``` ❮ BUN_BE_BUN=1 opencode x typescript-language-server mise ERROR No version is set for shim: typescript-language-server Set a global default version with one of the following: mise use -g npm:typescript-language-server@4.3.4 mise ERROR Run with --verbose or MISE_VERBOSE=1 for more information ``` So somehow mise's shims get in the way. Installing `typescript-language-server` via mise actually makes it work and opencode finds and starts it as well.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#75