anomalyco / anomalyco/opencode
Standalone binary: built-in tools fail with 'Bun is not defined' on Linux x86_64
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
The opencode v1.18.5 standalone Linux binary (opencode-linux-x86_64.tar.gz) has a runtime bug where the built-in file system tools (Read, Write, Edit, Glob, Grep) fail with Bun is not defined:
Bun is not defined
The binary is a Bun-compiled ELF (bun build --compile), so the Bun global should be available. It is not, causing any tool that uses Bun.file(), Bun.write(), or similar Bun-specific APIs to fail.
Impact
- Read tool: cannot read files
- Write tool: cannot write files
- Edit tool: cannot edit files
- Glob tool: cannot search files
- Grep tool: cannot search content
- Bash tool: works fine (does not use Bun file APIs)
This makes the binary nearly unusable for coding tasks that require file operations.
Reproduction
- Download and extract
opencode-linux-x86_64.tar.gzfrom v1.18.5 release - Run
opencodein TUI mode - Try any file operation (Read, Write, Edit)
- Observe:
Bun is not defined
Environment
- Binary:
opencode-linux-x86_64v1.18.5 - OS: Linux (tested on Ubuntu 24.04)
- Arch: x86_64
- Bun v1.3.14 installed on system (does not help — the standalone binary should bundle its own runtime)
Additional context
- Installing
bunon the system PATH does not resolve the issue — the error is in the compiled binary's internal runtime - Upgrading
@opencode-ai/plugin(node_modules) from 1.17.8 to 1.18.5 does not help - The
opencode websubcommand works (starts the web server successfully), as does CLI mode for non-tool operations - Not related to #39017 (web UI content-type) or #38789 (desktop app) — different manifestation of what may be the same underlying standalone compilation issue
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with the v1.18.5 opencode-linux-x86_64 standalone binary on Ubuntu 24.04, then inspect the bun build --compile packaging and runtime path for the built-in file tools. Done means Read, Write, Edit, Glob, and Grep work without “Bun is not defined” while Bash and web behavior remain intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- bun, typescript
- Domain
- build-system, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100