Skip to content

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

Closed

Description

@shsma

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

Activity

  1. added
    bugSomething isn't working
    on Feb 2, 2026
  2. added
    perfIndicates a performance issue or need for optimization
    on Feb 2, 2026
  3. github-actions commented on Feb 2, 2026

    @github-actions
    Contributor

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

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

  4. linuxmobile commented on Feb 3, 2026

    @linuxmobile

    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

  5. 0xd3e commented on Feb 4, 2026

    @0xd3e

    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: oven-sh/bun#4988

    The issue also has some comments regarding Linux.

  6. github-actions commented on Apr 6, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingperfIndicates a performance issue or need for optimization

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions