opencode icon indicating copy to clipboard operation
opencode copied to clipboard

"Unexpected EOF" crash immediately after startup

Open gcp opened this issue 2 months ago • 21 comments

Description

Box with error "Unexpected EOF" in the upper right.

zsh: trace trap opencode

OpenCode version

0.15.29

Steps to reproduce

  1. Launch opencode (no further action needed)

Logs show nothing interesting:

DEBUG 2025-10-30T11:23:01 +1ms service=tui TUI launched
INFO  2025-10-30T11:23:01 +5ms service=server method=GET path=/command request
INFO  2025-10-30T11:23:01 +0ms service=server duration=0 response
DEBUG 2025-10-30T11:23:01 +1ms service=tui config={"$schema":"","agent":{"build":{"description":"","disable":false,"mode":"","model":"","permission":{"edit":"","webfetch":""},"prompt":"","temperature":0,"tools":{},"top_p":0},"general":{"description":"","disable":false,"mode":"","model":"","permission":{"edit":"","webfetch":""},"prompt":"","temperature":0,"tools":{},"top_p":0},"plan":{"description":"","disable":false,"mode":"","model":"","permission":{"edit":"","webfetch":""},"prompt":"","temperature":0,"tools":{},"top_p":0}},"autoshare":false,"autoupdate":false,"command":{},"disabled_providers":[],"experimental":{"disable_paste_summary":false,"hook":{"file_edited":{},"session_completed":[]}},"formatter":{},"instructions":[],"keybinds":{"agent_cycle":"","agent_cycle_reverse":"","agent_list":"","app_exit":"","app_help":"","editor_open":"","file_close":"","file_diff_toggle":"","file_list":"","file_search":"","input_clear":"","input_newline":"","input_paste":"","input_submit":"","leader":"ctrl+x","messages_copy":"","messages_first":"","messages_half_page_down":"","messages_half_page_up":"","messages_last":"","messages_layout_toggle":"","messages_next":"","messages_page_down":"","messages_page_up":"","messages_previous":"","messages_redo":"","messages_revert":"","messages_undo":"","model_cycle_recent":"","model_cycle_recent_reverse":"","model_list":"","project_init":"","session_child_cycle":"","session_child_cycle_reverse":"","session_compact":"","session_export":"","session_interrupt":"","session_list":"","session_new":"","session_share":"","session_timeline":"","session_unshare":"","switch_agent":"","switch_agent_reverse":"","switch_mode":"","switch_mode_reverse":"","theme_list":"","thinking_blocks":"","tool_details":""},"layout":"","lsp":{},"mcp":{},"mode":{"build":{"description":"","disable":false,"mode":"","model":"","permission":{"edit":"","webfetch":""},"prompt":"","temperature":0,"tools":{},"top_p":0},"plan":{"description":"","disable":false,"mode":"","model":"","permission":{"edit":"","webfetch":""},"prompt":"","temperature":0,"tools":{},"top_p":0}},"model":"","permission":{"edit":"","webfetch":""},"plugin":[],"provider":{},"share":"","small_model":"","snapshot":false,"theme":"","tools":{},"tui":{"scroll_speed":0},"username":"morbo","watcher":{"ignore":[]}} Loaded config
INFO  2025-10-30T11:23:01 +0ms service=server method=GET path=/file/status request
INFO  2025-10-30T11:23:01 +0ms service=tui commands={"agent_cycle":{},"agent_cycle_reverse":{},"agent_list":{},"app_exit":{},"app_help":{},"editor_open":{},"input_clear":{},"input_newline":{},"input_paste":{},"input_submit":{},"messages_copy":{},"messages_first":{},"messages_half_page_down":{},"messages_half_page_up":{},"messages_last":{},"messages_page_down":{},"messages_page_up":{},"messages_redo":{},"messages_undo":{},"model_cycle_recent":{},"model_cycle_recent_reverse":{},"model_list":{},"project_init":{},"session_child_cycle":{},"session_child_cycle_reverse":{},"session_compact":{},"session_export":{},"session_interrupt":{},"session_list":{},"session_new":{},"session_share":{},"session_timeline":{},"session_unshare":{},"theme_list":{},"thinking_blocks":{},"tool_details":{}} Loaded commands
INFO  2025-10-30T11:23:01 +1ms service=server method=GET path=/event request
INFO  2025-10-30T11:23:01 +0ms service=server event connected
INFO  2025-10-30T11:23:01 +0ms service=bus type=* subscribing
INFO  2025-10-30T11:23:01 +1ms service=server duration=1 response
INFO  2025-10-30T11:23:01 +0ms service=server method=GET path=/tui/control/next request
INFO  2025-10-30T11:23:01 +0ms service=server method=GET path=/config/providers request
INFO  2025-10-30T11:23:01 +1ms service=server duration=1 response
DEBUG 2025-10-30T11:23:01 +2ms service=tui model=deepseek-chat provider=deepseek Selected model from recent usage
DEBUG 2025-10-30T11:23:01 +6ms service=tui timeTakenMs=0 messages.renderView
DEBUG 2025-10-30T11:23:01 +6ms service=tui file=/Users/morbo/.local/state/opencode/tui State saved to file
DEBUG 2025-10-30T11:23:01 +5ms service=tui color=#ffffff isDark=false Background color
DEBUG 2025-10-30T11:23:01 +4ms service=tui timeTakenMs=0 messages.renderView
DEBUG 2025-10-30T11:23:01 +0ms service=tui file=/Users/morbo/.local/state/opencode/tui State saved to file

Screenshot and/or share link

No response

Operating System

macOS 26.0.1

Terminal

iTerm2 3.6.5

gcp avatar Oct 30 '25 11:10 gcp

This issue might be a duplicate of existing issues. Please check:

  • #1659: Very similar SIGTRAP (Trace or breakpoint trap) crashes on macOS with iTerm2, may be related to Pointer Authentication on newer macOS versions
  • #1841: Same "unexpected EOF" error message with SIGTRAP crashes, though that was directory-specific

Feel free to ignore if none of these address your specific case.

github-actions[bot] avatar Oct 30 '25 11:10 github-actions[bot]

does this happen on 0.15.28 too?

rekram1-node avatar Oct 30 '25 13:10 rekram1-node

Yes.

gcp avatar Oct 30 '25 14:10 gcp

hm okay, is it possible to show a full log dump of:

opencode run hello --print-logs

rekram1-node avatar Oct 30 '25 14:10 rekram1-node

opencode run hello --print-logs

INFO  2025-10-30T15:24:38 +60ms service=default version=0.15.29 args=["run","hello","--print-logs"] opencode
INFO  2025-10-30T15:24:38 +1ms service=project directory=/Users/morbo/git/scrax fromDirectory
INFO  2025-10-30T15:24:38 +29ms service=config path=/Users/morbo/.config/opencode/config.json loading
INFO  2025-10-30T15:24:38 +0ms service=config path=/Users/morbo/.config/opencode/opencode.json loading
INFO  2025-10-30T15:24:38 +0ms service=config path=/Users/morbo/.config/opencode/opencode.jsonc loading
INFO  2025-10-30T15:24:38 +1ms service=bun cmd=["/opt/homebrew/Cellar/opencode/0.15.29/libexec/lib/node_modules/opencode-ai/node_modules/opencode-darwin-arm64/bin/opencode","add","@opencode-ai/[email protected]","--exact"] cwd=/Users/morbo/.config/opencode running
INFO  2025-10-30T15:24:38 +1ms service=plugin [email protected] loading plugin
INFO  2025-10-30T15:24:38 +1ms service=plugin [email protected] loading plugin
INFO  2025-10-30T15:24:38 +10ms service=bus type=* subscribing
INFO  2025-10-30T15:24:38 +0ms service=bus type=session.updated subscribing
INFO  2025-10-30T15:24:38 +0ms service=bus type=message.updated subscribing
INFO  2025-10-30T15:24:38 +0ms service=bus type=message.part.updated subscribing
INFO  2025-10-30T15:24:38 +0ms service=format init
INFO  2025-10-30T15:24:38 +0ms service=bus type=file.edited subscribing
INFO  2025-10-30T15:24:38 +1ms service=session id=ses_5ca477285ffe5Ap79Crr2CtQou version=0.15.29 projectID=8cf3c9044b9da3d47a4c1d55b77650e60d0dc11d directory=/Users/morbo/git/scrax title=New session - 2025-10-30T15:24:38.650Z time={"created":1761837878650,"updated":1761837878650} created
INFO  2025-10-30T15:24:38 +1ms service=lsp serverIds=deno, typescript, vue, eslint, gopls, ruby-lsp, pyright, elixir-ls, zls, csharp, rust, clangd, svelte, astro, jdtls, lua-ls enabled LSP servers
INFO  2025-10-30T15:24:38 +0ms service=bus type=session.created publishing
INFO  2025-10-30T15:24:38 +0ms service=bus type=session.updated publishing
INFO  2025-10-30T15:24:38 +2ms service=bus type=message.part.updated subscribing
INFO  2025-10-30T15:24:38 +0ms service=bus type=session.error subscribing
INFO  2025-10-30T15:24:38 +0ms service=session.prompt session=ses_5ca477285ffe5Ap79Crr2CtQou prompt
INFO  2025-10-30T15:24:38 +1ms service=bun code=0 stdout=bun add v1.3.0 (b0a6feca)

installed @opencode-ai/[email protected]

[1.00ms] done
 stderr=Saved lockfile
 done
INFO  2025-10-30T15:24:38 +2ms service=bus type=message.updated publishing
INFO  2025-10-30T15:24:38 +4ms service=bus type=message.part.updated publishing
INFO  2025-10-30T15:24:38 +1ms service=bus type=session.updated publishing
INFO  2025-10-30T15:24:38 +1ms service=models.dev file={} refreshing
INFO  2025-10-30T15:24:38 +1ms service=provider init
INFO  2025-10-30T15:24:38 +1ms service=provider providerID=deepseek found
INFO  2025-10-30T15:24:38 +0ms service=provider providerID=openai found
INFO  2025-10-30T15:24:38 +0ms service=provider providerID=openrouter found
INFO  2025-10-30T15:24:38 +0ms service=provider providerID=opencode found
INFO  2025-10-30T15:24:38 +0ms service=provider providerID=github-copilot found
INFO  2025-10-30T15:24:38 +0ms service=provider providerID=deepseek modelID=deepseek-chat getModel
INFO  2025-10-30T15:24:38 +0ms service=provider status=started providerID=deepseek getSDK
INFO  2025-10-30T15:24:38 +26ms service=provider status=completed duration=26 providerID=deepseek getSDK
INFO  2025-10-30T15:24:38 +1ms service=provider providerID=deepseek modelID=deepseek-chat found
INFO  2025-10-30T15:24:38 +0ms service=session.lock sessionID=ses_5ca477285ffe5Ap79Crr2CtQou locked
INFO  2025-10-30T15:24:38 +0ms service=session.prompt session=ses_5ca477285ffe5Ap79Crr2CtQou sessionID=ses_5ca477285ffe5Ap79Crr2CtQou locking
INFO  2025-10-30T15:24:38 +16ms service=bus type=message.updated publishing
INFO  2025-10-30T15:24:38 +4ms service=session.prompt session=ses_5ca477285ffe5Ap79Crr2CtQou process
INFO  2025-10-30T15:24:38 +1ms service=session.prompt session=ses_5ca477285ffe5Ap79Crr2CtQou type=start part
INFO  2025-10-30T15:24:38 +4ms service=bus type=message.updated publishing
INFO  2025-10-30T15:24:38 +0ms service=bus type=session.updated publishing
INFO  2025-10-30T15:24:39 +1120ms service=bus type=session.updated publishing
INFO  2025-10-30T15:24:40 +288ms service=session.prompt session=ses_5ca477285ffe5Ap79Crr2CtQou type=start-step part

Here things just hang.

gcp avatar Oct 30 '25 15:10 gcp

may be something with the deepseek provider, curious

rekram1-node avatar Oct 30 '25 16:10 rekram1-node

I initially hit this while trying to use LM Studio with a local LLM, I then moved away my opencode config to check if that was the problem, but clearly it wasn't.

gcp avatar Oct 30 '25 16:10 gcp

~/.local/share/opencode/auth.json has a DeepSeek API key as the first thing in it, so (random guess) that's why it is being defaulted after I removed my config?

gcp avatar Oct 30 '25 16:10 gcp

Yeah it is, hm one other thing to try:

opencode run hello --print-logs --model opencode/grok-code

rekram1-node avatar Oct 30 '25 17:10 rekram1-node

opencode run hello --print-logs --model opencode/grok-code

INFO  2025-10-30T19:48:58 +71ms service=default version=0.15.29 args=["run","hello","--print-logs","--model","opencode/grok-code"] opencode
INFO  2025-10-30T19:48:58 +1ms service=project directory=/Users/morbo/git/scrax fromDirectory
INFO  2025-10-30T19:48:58 +148ms service=config path=/Users/morbo/.config/opencode/config.json loading
INFO  2025-10-30T19:48:58 +0ms service=config path=/Users/morbo/.config/opencode/opencode.json loading
INFO  2025-10-30T19:48:58 +0ms service=config path=/Users/morbo/.config/opencode/opencode.jsonc loading
INFO  2025-10-30T19:48:58 +2ms service=bun cmd=["/opt/homebrew/Cellar/opencode/0.15.29/libexec/lib/node_modules/opencode-ai/node_modules/opencode-darwin-arm64/bin/opencode","add","@opencode-ai/[email protected]","--exact"] cwd=/Users/morbo/.config/opencode running
INFO  2025-10-30T19:48:58 +1ms service=plugin [email protected] loading plugin
INFO  2025-10-30T19:48:58 +8ms service=plugin [email protected] loading plugin
INFO  2025-10-30T19:48:59 +22ms service=bus type=* subscribing
INFO  2025-10-30T19:48:59 +0ms service=bus type=session.updated subscribing
INFO  2025-10-30T19:48:59 +0ms service=bus type=message.updated subscribing
INFO  2025-10-30T19:48:59 +0ms service=bus type=message.part.updated subscribing
INFO  2025-10-30T19:48:59 +0ms service=format init
INFO  2025-10-30T19:48:59 +0ms service=bus type=file.edited subscribing
INFO  2025-10-30T19:48:59 +2ms service=session id=ses_5c9556ff5ffeWzsuE2pRcwuCH5 version=0.15.29 projectID=8cf3c9044b9da3d47a4c1d55b77650e60d0dc11d directory=/Users/morbo/git/scrax title=New session - 2025-10-30T19:48:59.018Z time={"created":1761853739018,"updated":1761853739018} created
INFO  2025-10-30T19:48:59 +0ms service=lsp serverIds=deno, typescript, vue, eslint, gopls, ruby-lsp, pyright, elixir-ls, zls, csharp, rust, clangd, svelte, astro, jdtls, lua-ls enabled LSP servers
INFO  2025-10-30T19:48:59 +0ms service=bus type=session.created publishing
INFO  2025-10-30T19:48:59 +0ms service=bus type=session.updated publishing
INFO  2025-10-30T19:48:59 +1ms service=bus type=message.part.updated subscribing
INFO  2025-10-30T19:48:59 +0ms service=bus type=session.error subscribing
INFO  2025-10-30T19:48:59 +0ms service=session.prompt session=ses_5c9556ff5ffeWzsuE2pRcwuCH5 prompt
INFO  2025-10-30T19:48:59 +4ms service=bun code=0 stdout=bun add v1.3.0 (b0a6feca)

installed @opencode-ai/[email protected]

[9.00ms] done
 stderr=Saved lockfile
 done
INFO  2025-10-30T19:48:59 +0ms service=bus type=message.updated publishing
INFO  2025-10-30T19:48:59 +2ms service=bus type=message.part.updated publishing
INFO  2025-10-30T19:48:59 +0ms service=bus type=session.updated publishing
INFO  2025-10-30T19:48:59 +2ms service=models.dev file={} refreshing
INFO  2025-10-30T19:48:59 +2ms service=provider init
INFO  2025-10-30T19:48:59 +0ms service=provider providerID=deepseek found
INFO  2025-10-30T19:48:59 +1ms service=provider providerID=openai found
INFO  2025-10-30T19:48:59 +0ms service=provider providerID=openrouter found
INFO  2025-10-30T19:48:59 +0ms service=provider providerID=opencode found
INFO  2025-10-30T19:48:59 +0ms service=provider providerID=github-copilot found
INFO  2025-10-30T19:48:59 +0ms service=provider providerID=opencode modelID=grok-code getModel
INFO  2025-10-30T19:48:59 +0ms service=provider status=started providerID=opencode getSDK
INFO  2025-10-30T19:48:59 +0ms service=bun pkg=@ai-sdk/openai-compatible version=latest installing package using Bun's default registry resolution
INFO  2025-10-30T19:48:59 +0ms service=bun cmd=["/opt/homebrew/Cellar/opencode/0.15.29/libexec/lib/node_modules/opencode-ai/node_modules/opencode-darwin-arm64/bin/opencode","add","--force","--exact","--cwd","/Users/morbo/.cache/opencode","@ai-sdk/openai-compatible@latest"] cwd=/Users/morbo/.cache/opencode running
INFO  2025-10-30T19:48:59 +898ms service=bun code=0 stdout=bun add v1.3.0 (b0a6feca)

+ [email protected]
+ [email protected]

installed @ai-sdk/[email protected]

21 packages installed [894.00ms]
 stderr=Resolving dependencies
Resolved, downloaded and extracted [16]
Saved lockfile
 done
INFO  2025-10-30T19:48:59 +36ms service=provider status=completed duration=934 providerID=opencode getSDK
INFO  2025-10-30T19:48:59 +0ms service=provider providerID=opencode modelID=grok-code found
INFO  2025-10-30T19:48:59 +0ms service=session.lock sessionID=ses_5c9556ff5ffeWzsuE2pRcwuCH5 locked
INFO  2025-10-30T19:48:59 +0ms service=session.prompt session=ses_5c9556ff5ffeWzsuE2pRcwuCH5 sessionID=ses_5c9556ff5ffeWzsuE2pRcwuCH5 locking
INFO  2025-10-30T19:48:59 +12ms service=bus type=message.updated publishing
INFO  2025-10-30T19:48:59 +4ms service=session.prompt session=ses_5c9556ff5ffeWzsuE2pRcwuCH5 process
INFO  2025-10-30T19:48:59 +2ms service=session.prompt session=ses_5c9556ff5ffeWzsuE2pRcwuCH5 type=start part
INFO  2025-10-30T19:48:59 +4ms service=bus type=message.updated publishing
INFO  2025-10-30T19:48:59 +0ms service=bus type=session.updated publishing
INFO  2025-10-30T19:49:01 +1205ms service=session.prompt session=ses_5c9556ff5ffeWzsuE2pRcwuCH5 type=start-step part
INFO  2025-10-30T19:49:08 +7573ms service=bus type=session.updated publishing

gcp avatar Oct 30 '25 19:10 gcp

Wow so all of them hang, that's interesting...

rekram1-node avatar Oct 30 '25 19:10 rekram1-node

Hmm, running it in a freshly made dir makes the problem go away, but there's nothing related to opencode in the dir where this hangs. Relevant stuff:

morbo@MacBook-Pro-2:~/git/scrax % ls -a -l
drwxr-xr-x 107 morbo staff       3424 okt. 30 18:18 .
drwxr-xr-x  50 morbo staff       1600 sep. 11 11:42 ..
-rw-r--r--   1 morbo staff    1856414 okt. 30 14:09 .aider.chat.history.md
-rw-r--r--   1 morbo staff        853 jun. 24 12:56 .aider.conf.yml
-rw-r--r--   1 morbo staff      95888 apr. 22  2025 .aider.input.history
drwxr-xr-x   3 morbo staff         96 okt. 30 14:09 .aider.tags.cache.v4
drwxr-xr-x   3 morbo staff         96 okt. 10 10:38 .cargo
drwxr-xr-x   5 morbo staff        160 okt. 30 18:27 .claude
drwxr-xr-x   6 morbo staff        192 okt. 30 12:06 .crush
-rw-r--r--   1 morbo staff      12292 okt.  7 20:36 .DS_Store
drwxr-xr-x  16 morbo staff        512 okt. 30 18:22 .git
drwxr-xr-x   3 morbo staff         96 okt. 10 10:38 .github
-rw-r--r--   1 morbo staff        228 okt. 10 10:38 .gitignore
-rw-r--r--   1 morbo staff        172 okt. 10 10:38 .typos.toml
drwxr-xr-x   8 morbo staff        256 okt. 21 18:58 .venv
-rw-r--r--   1 morbo staff       2858 okt. 10 16:17 AGENTS.md
drwxr-xr-x   3 morbo staff         96 okt. 10 10:38 benches
-rw-r--r--   1 morbo staff     119012 okt. 23 13:23 Cargo.lock
-rw-r--r--   1 morbo staff        691 okt. 10 10:38 Cargo.toml
-rwxr-xr-x   1 morbo staff        472 okt. 10 10:38 check.sh
-rw-r--r--   1 morbo staff       4101 okt. 30 15:44 CLAUDE.md
-rw-r--r--   1 morbo staff       1818 okt.  4 20:10 CRUSH.md
...
-rw-r--r--   1 morbo staff        422 okt. 10 10:38 rust-toolchain
...
drwxr-xr-x  11 morbo staff        352 jun. 24 12:42 target
drwxr-xr-x   3 morbo staff         96 jul. 23 22:43 uploads
-rw-r--r--   1 morbo staff     216989 okt. 21 18:58 uv.lock
...

gcp avatar Oct 30 '25 19:10 gcp

Can u tell me anything about the dir it did hang in? I bet ripgrep was hanging for some reason

Was it a git project? Was it a large dir with a lot of subdirectories, etc

rekram1-node avatar Oct 30 '25 19:10 rekram1-node

ripgrep returns instantly in this dir (i.e. searches take milliseconds). It's a Rust project. There's 23G there, but 18G of that are just Rust compilation artifacts.

You gave me an idea: there is a 3G textfile in the project. If I move it out of the working dir, opencode launches.

gcp avatar Oct 30 '25 19:10 gcp

Okay, having that textfile anywhere in the project dir (even subdirs) makes opencode die.

That explains why this problem suddenly occured, it's RL training data that was recently generated.

gcp avatar Oct 30 '25 20:10 gcp

Ah interesting, something in our code is doing excessive work then, that shouldn't cause a hang. We will need to look into it

rekram1-node avatar Oct 30 '25 20:10 rekram1-node

Note the original issue is an actual crash, but I can imagine something trying to process that file and hitting a 2GB or 4GB limit or something.

gcp avatar Oct 30 '25 20:10 gcp

Noted, thanks for helping us get to the bottom of this!

rekram1-node avatar Oct 30 '25 20:10 rekram1-node

Note that I ran into the same issue by having a cloud image of over 2G of in the working directory of opencode. It would crash the TUI instantly when starting a conversation with the error "Unexpected EOF"

Sawangg avatar Oct 31 '25 12:10 Sawangg

This should stop the problem: https://github.com/ry2009/opencode/pull/5

ry2009 avatar Dec 09 '25 23:12 ry2009

@ry2009 commented on ur pr

rekram1-node avatar Dec 09 '25 23:12 rekram1-node