Skip to content

opencode: fix Bun 1.4 runtime server error - #564101

Merged
onny merged 1 commit into
NixOS:masterfrom
robotron2084:opencode-1.18.30
Sep 18, 2026
Merged

onny merged 1 commit into
NixOS:masterfrom
robotron2084:opencode-1.18.30

Conversation

@robotron2084

@robotron2084 robotron2084 commented Sep 17, 2026 •

Copy link
Copy Markdown

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 with
splitting: false avoids the regression.

Fixes #563241.

Testing

  • nix build .#opencode -L
  • Started the resulting ./result/bin/opencode successfully 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

@robotron2084

Copy link
Copy Markdown
Author

One note about disk size: I did notice this did increase the binary on mac here from 114M to 218M.

@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 12.first-time contribution This PR is the author's first one; please be gentle! labels Sep 17, 2026
@nixpkgs-review-gha

Copy link
Copy Markdown

✅ nixpkgs-review result

Generated using nixpkgs-review-gha (00a1ae2)

Command: nixpkgs-review pr 564101
Commit: 994643a136e95ac0c28dc1c33ac404244d131eeb (subsequent changes)
Merge: 7e8be4ab5ab24336f9cc36f0d0af6b529ed380d8

Triggered by @staticdev (1446633)
Logs: https://github.com/staticdev/nixpkgs-review-gha/actions/runs/35199189118/attempts/1


x86_64-linux

✅ 1 package built:
  • opencode

aarch64-linux

✅ 1 package built:
  • opencode

x86_64-darwin

✅ No rebuilds


aarch64-darwin (sandbox = relaxed)

✅ 1 package built:
  • opencode

@nixpkgs-ci nixpkgs-ci Bot added the 12.approvals: 1 This PR was reviewed and approved by one person. label Sep 17, 2026
@delafthi

Copy link
Copy Markdown
Contributor

Thanks, for investigating this and submitting a patch.

@nixpkgs-ci nixpkgs-ci Bot added 12.approvals: 2 This PR was reviewed and approved by two persons. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages. and removed 12.approvals: 1 This PR was reviewed and approved by one person. labels Sep 17, 2026
@robotron2084

Copy link
Copy Markdown
Author

Thanks, for investigating this and submitting a patch.

No problem! This is my first nixpkgs PR, so lmk if you have any questions.

@onny

onny commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 564101
Commit: 994643a136e95ac0c28dc1c33ac404244d131eeb


x86_64-linux

✅ 1 package built:
  • opencode

@onny
onny added this pull request to the merge queue Sep 18, 2026
Merged via the queue into NixOS:master with commit d4448fe Sep 18, 2026
32 checks passed
@delafthi delafthi mentioned this pull request Sep 18, 2026
5 of 11 tasks
gaelj pushed a commit to gaelj/nixpkgs that referenced this pull request Sep 19, 2026
jyap808 added a commit to jyap808/nix-custom-pkgs that referenced this pull request Sep 21, 2026
sethkrasnianski added a commit to sethkrasnianski/nix-config that referenced this pull request Sep 21, 2026
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.
difro added a commit to difro/dotfiles that referenced this pull request Sep 23, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 12.approvals: 2 This PR was reviewed and approved by two persons. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages. 12.first-time contribution This PR is the author's first one; please be gentle!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

opencode: server error after sending prompt

5 participants