Embedded bun runtime hangs indefinitely on bun add during bootstrap on Linux (BunInstallFailedError) #8362

Open
opened 2026-02-16 18:09:46 -05:00 by yindo · 3 comments
Owner

Originally created by @shsma on GitHub (Feb 2, 2026).

Originally assigned to: @thdxr on GitHub.

Description

Summary

OpenCode v1.1.48 fails to launch on Ubuntu 24.04 (x86_64). The TUI renders a blank screen because the embedded bun runtime hangs indefinitely when trying to install @opencode-ai/plugin during bootstrap. This is related to #5223 but the .npmrc removal workaround
does not resolve it.

Environment

  • OpenCode version: 1.1.48
  • OS: Ubuntu 24.04.3 LTS (Noble Numbat)
  • Kernel: 6.14.0-37-generic x86_64
  • Node: v24.13.0
  • npm: 11.6.2
  • Embedded bun: 1.3.5
  • Terminal: kitty (xterm-kitty, truecolor)
  • Network: npm registry is reachable (curl https://registry.npmjs.org returns 200)

Symptoms

  1. Running opencode shows a blank TUI — no UI elements render
  2. Logs show bootstrap hangs at the first bun add call and never progresses:
    INFO service=bun cmd=["/home/user/.opencode/bin/opencode","add","@opencode-ai/plugin@1.1.48","--exact"] cwd=/home/user/.config/opencode running No further log output after this line.
  3. When the bun subprocess does eventually get killed (e.g. by SIGHUP), it exits with code 129 and produces BunInstallFailedError:
    INFO service=bun code=129 stdout=bun add v1.3.5 (1e86cebd) stderr=Resolving dependencies done
    ERROR service=plugin pkg=opencode-anthropic-auth version=0.0.13 error=BunInstallFailedError failed to install builtin plugin
  4. Each failed launch leaves orphaned processes behind. Subsequent launches also hang because those zombie processes hold locks on
    node_modules.

Workaround

Pre-install the packages using system npm so bun finds existing node_modules and a lockfile to migrate from (completes in milliseconds
instead of hanging):

# Kill any stale processes first                                                                                                           
pkill -9 -f opencode                                                                                                                       
                                                                                                                                           
# Clean up corrupted state                                                                                                                 
rm -rf ~/.cache/opencode/node_modules ~/.config/opencode/node_modules ~/.opencode/node_modules                                             
                                                                                                                                           
# Pre-install via npm                                                                                                                      
cd ~/.config/opencode && npm install --save-exact @opencode-ai/plugin@1.1.48                                                               
cd ~/.opencode && npm install --save-exact @opencode-ai/plugin@1.1.48                                                                      
cd ~/.cache/opencode && npm install --save-exact opencode-anthropic-auth@0.0.13 @gitlab/opencode-gitlab-auth@1.3.2                         
                                                                                                                                           
# Now opencode launches successfully                                                                                                       
opencode                                                                                                                                   
                                                                                                                                           
After this, bun's add command succeeds with code 0 because it migrates from the existing package-lock.json rather than resolving from      
scratch.                                                                                                                                   
                                                                                                                                           
Root cause                                                                                                                                 
                                                                                                                                           
The embedded bun 1.3.5 runtime hangs indefinitely when resolving packages from the npm registry on a cold install (no existing node_modules
 or lockfile). The npm registry is reachable and system npm installs the same packages without issue. OPENCODE_DISABLE_DEFAULT_PLUGINS=1   
does not help because the hang occurs on the core @opencode-ai/plugin, not the default auth plugins.                                       
                                                                                                                                           
Expected behavior                                                                                                                          
                                                                                                                                           
OpenCode should either:                                                                                                                    
1. Ship with its core plugin bundled so bootstrap doesn't require a network install                                                        
2. Add a timeout to the bun subprocess so it fails gracefully instead of hanging forever                                                   
3. Fall back to system npm/npx if the embedded bun fails  

Plugins

No response

OpenCode version

No response

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Originally created by @shsma on GitHub (Feb 2, 2026). Originally assigned to: @thdxr on GitHub. ### Description # Summary OpenCode v1.1.48 fails to launch on Ubuntu 24.04 (x86_64). The TUI renders a blank screen because the embedded bun runtime hangs indefinitely when trying to install `@opencode-ai/plugin` during bootstrap. This is related to #5223 but the `.npmrc` removal workaround does not resolve it. ## Environment - **OpenCode version:** 1.1.48 - **OS:** Ubuntu 24.04.3 LTS (Noble Numbat) - **Kernel:** 6.14.0-37-generic x86_64 - **Node:** v24.13.0 - **npm:** 11.6.2 - **Embedded bun:** 1.3.5 - **Terminal:** kitty (xterm-kitty, truecolor) - **Network:** npm registry is reachable (`curl https://registry.npmjs.org` returns 200) ## Symptoms 1. Running `opencode` shows a blank TUI — no UI elements render 2. Logs show bootstrap hangs at the first `bun add` call and never progresses: INFO service=bun cmd=["/home/user/.opencode/bin/opencode","add","@opencode-ai/plugin@1.1.48","--exact"] cwd=/home/user/.config/opencode running No further log output after this line. 3. When the bun subprocess does eventually get killed (e.g. by SIGHUP), it exits with code 129 and produces `BunInstallFailedError`: INFO service=bun code=129 stdout=bun add v1.3.5 (1e86cebd) stderr=Resolving dependencies done ERROR service=plugin pkg=opencode-anthropic-auth version=0.0.13 error=BunInstallFailedError failed to install builtin plugin 4. Each failed launch leaves orphaned processes behind. Subsequent launches also hang because those zombie processes hold locks on `node_modules`. ## Workaround Pre-install the packages using system `npm` so bun finds existing `node_modules` and a lockfile to migrate from (completes in milliseconds instead of hanging): ```bash # Kill any stale processes first pkill -9 -f opencode # Clean up corrupted state rm -rf ~/.cache/opencode/node_modules ~/.config/opencode/node_modules ~/.opencode/node_modules # Pre-install via npm cd ~/.config/opencode && npm install --save-exact @opencode-ai/plugin@1.1.48 cd ~/.opencode && npm install --save-exact @opencode-ai/plugin@1.1.48 cd ~/.cache/opencode && npm install --save-exact opencode-anthropic-auth@0.0.13 @gitlab/opencode-gitlab-auth@1.3.2 # Now opencode launches successfully opencode After this, bun's add command succeeds with code 0 because it migrates from the existing package-lock.json rather than resolving from scratch. Root cause The embedded bun 1.3.5 runtime hangs indefinitely when resolving packages from the npm registry on a cold install (no existing node_modules or lockfile). The npm registry is reachable and system npm installs the same packages without issue. OPENCODE_DISABLE_DEFAULT_PLUGINS=1 does not help because the hang occurs on the core @opencode-ai/plugin, not the default auth plugins. Expected behavior OpenCode should either: 1. Ship with its core plugin bundled so bootstrap doesn't require a network install 2. Add a timeout to the bun subprocess so it fails gracefully instead of hanging forever 3. Fall back to system npm/npx if the embedded bun fails ``` ### Plugins _No response_ ### OpenCode version _No response_ ### Steps to reproduce _No response_ ### Screenshot and/or share link _No response_ ### Operating System _No response_ ### Terminal _No response_
yindo added the bugperf labels 2026-02-16 18:09:46 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Feb 2, 2026):

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

  • #10921: Bun add hangs forever
  • #10614: opencode auth login throw BunInstallFailedError
  • #9075: BunInstallFailedError for opencode-antigravity-auth@1.2.8
  • #5223: Can't open opencode after install
  • #11374: Blank screen for ~10 seconds on startup when running inside a VM or container

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

@github-actions[bot] commented on GitHub (Feb 2, 2026): This issue might be a duplicate of existing issues. Please check: - #10921: Bun add hangs forever - #10614: opencode auth login throw `BunInstallFailedError` - #9075: BunInstallFailedError for opencode-antigravity-auth@1.2.8 - #5223: Can't open opencode after install - #11374: Blank screen for ~10 seconds on startup when running inside a VM or container Feel free to ignore if none of these address your specific case.
Author
Owner

@linuxmobile commented on GitHub (Feb 2, 2026):

Same issue. @adamdotdevin Did you know? there's a lot of issues with the same error, i'm trying to deal with it all day

@linuxmobile commented on GitHub (Feb 2, 2026): Same issue. @adamdotdevin Did you know? there's a lot of issues with the same error, i'm trying to deal with it all day
Author
Owner

@0xd3e commented on GitHub (Feb 4, 2026):

I had the same issue and remembered an issue I had with bun when installing packages.
So I did the same that I did back then, which was setting the IPv6 configuration to link-local only. This fixed the issue for me.

There is a bun issue about that: https://github.com/oven-sh/bun/issues/4988

The issue also has some comments regarding Linux.

@0xd3e commented on GitHub (Feb 4, 2026): I had the same issue and remembered an issue I had with bun when installing packages. So I did the same that I did back then, which was setting the IPv6 configuration to link-local only. This fixed the issue for me. There is a bun issue about that: https://github.com/oven-sh/bun/issues/4988 The issue also has some comments regarding Linux.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#8362