Repository navigation
opencode: fix Bun 1.4 runtime server error - #564101
Conversation
|
One note about disk size: I did notice this did increase the binary on mac here from 114M to 218M. |
✅
|
|
Thanks, for investigating this and submitting a patch. |
No problem! This is my first nixpkgs PR, so lmk if you have any questions. |
|
Fix is now upstream via NixOS/nixpkgs#564101
opencode 1.18.30 on our pinned nixpkgs fails every prompt with "Unexpected server error" (TypeError: undefined is not an object (evaluating 'a.name') in SystemPrompt.environment) — a Bun 1.4.2 code-splitting regression baked into the compiled binary (NixOS/nixpkgs#563241). Fixed upstream by NixOS/nixpkgs#564101 (disables splitting), merged 2026-09-18, but our nixpkgs pin predates it by one day and nixos-unstable hasn't picked it up yet. Overlay just the opencode package from the fix commit (binary-cache hit, verified working) until a routine flake update moves past it.
nixpkgs now builds opencode with `splitting: false` to work around the Bun 1.4 code splitting regression (NixOS/nixpkgs#564101), so opencode 1.18.31 built with bun 1.4.2 no longer fails every prompt in SystemPrompt.environment. Upstream also broke the filesystem import cycle in 1.18.32 (anomalyco/opencode#50439). Drop the nixpkgs-bun input and build opencode with the default bun again. The glibc 2.40 interpreter patch is a separate issue and stays.
Description
Disable Bun executable code splitting when building OpenCode.
Bun 1.4.2 produces a compiled OpenCode executable that crashes at startup with
TypeError: undefined is not an object (evaluating 'a.name'). Building withsplitting: falseavoids the regression.Fixes #563241.
Testing
nix build .#opencode -L./result/bin/opencodesuccessfully on aarch64-darwin.AI assistance
ChatGPT assisted with investigating the Bun build regression and drafting this
change. I reviewed and validated the final patch locally.
Things done
passthru.tests.nixpkgs-reviewon this PR. See nixpkgs-review usage../result/bin/.