Regression bug happened somewhere between 0.5.xx and 0.6.xx, seen with nixpkgs. #1644

Closed
opened 2026-02-16 17:31:55 -05:00 by yindo · 4 comments
Owner

Originally created by @SylvaraTheDev on GitHub (Sep 7, 2025).

I'm trying to design a Nix override to get Opencode 0.6.4 working and I'm running into what I think might be a regression bug.
Here's the Nix override for nixpkgs unstable, it builds just fine, but when running it I get a change dir fail where Opencode is attempting to cd onto it's binary instead of into a location. This happens on 0.6.4 and I've tested it on the official nixpkgs release on 0.6.3 and it's happening there as well.
I can confirm back when nixpkgs was on 0.5.xx it did work, so I think either during the late 0.5.xx stages or 0.6.x+ a regression happened.

final: prev: {
  opencode = prev.opencode.overrideAttrs (finalAttrs: previousAttrs: let
    newVersion = "0.6.4";
  in {
    version = newVersion;
    src = prev.fetchFromGitHub {
      owner = "sst";
      repo  = "opencode";
      tag   = "v${newVersion}";
      hash  = "sha256-o7SzDGbWgCh8cMNK+PeLxAw0bQMKFouHdedUslpA6gw=";
    };
    tui = previousAttrs.tui.overrideAttrs (_: {
      vendorHash = "sha256-8pwVQVraLSE1DRL6IFMlQ/y8HQ8464N/QwAS8Faloq4=";
    });
    node_modules = previousAttrs.node_modules.overrideAttrs (_: {
      outputHash = "sha256-PmLO0aU2E7NlQ7WtoiCQzLRw4oKdKxS5JI571lvbhHo=";
    });
  });
}
~/.config/nix> opencode
Error: Failed to change directory to /run/current-system/sw/bin/opencode
Originally created by @SylvaraTheDev on GitHub (Sep 7, 2025). I'm trying to design a Nix override to get Opencode 0.6.4 working and I'm running into what I think might be a regression bug. Here's the Nix override for nixpkgs unstable, it builds just fine, but when running it I get a change dir fail where Opencode is attempting to cd onto it's binary instead of into a location. This happens on 0.6.4 and I've tested it on the official nixpkgs release on 0.6.3 and it's happening there as well. I can confirm back when nixpkgs was on 0.5.xx it did work, so I think either during the late 0.5.xx stages or 0.6.x+ a regression happened. ```nix final: prev: { opencode = prev.opencode.overrideAttrs (finalAttrs: previousAttrs: let newVersion = "0.6.4"; in { version = newVersion; src = prev.fetchFromGitHub { owner = "sst"; repo = "opencode"; tag = "v${newVersion}"; hash = "sha256-o7SzDGbWgCh8cMNK+PeLxAw0bQMKFouHdedUslpA6gw="; }; tui = previousAttrs.tui.overrideAttrs (_: { vendorHash = "sha256-8pwVQVraLSE1DRL6IFMlQ/y8HQ8464N/QwAS8Faloq4="; }); node_modules = previousAttrs.node_modules.overrideAttrs (_: { outputHash = "sha256-PmLO0aU2E7NlQ7WtoiCQzLRw4oKdKxS5JI571lvbhHo="; }); }); } ``` ``` ~/.config/nix> opencode Error: Failed to change directory to /run/current-system/sw/bin/opencode ```
yindo closed this issue 2026-02-16 17:31:55 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Sep 7, 2025):

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

  • #2269: Same "Failed to change directory" error message, though in different context (init command)
  • #462: NixOS-specific issues with dynamic linking and installation problems
  • #1988: Missing dependencies in Nix builds affecting opencode functionality

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

@github-actions[bot] commented on GitHub (Sep 7, 2025): This issue might be a duplicate of existing issues. Please check: - #2269: Same "Failed to change directory" error message, though in different context (init command) - #462: NixOS-specific issues with dynamic linking and installation problems - #1988: Missing dependencies in Nix builds affecting opencode functionality Feel free to ignore if none of these address your specific case.
Author
Owner

@delafthi commented on GitHub (Sep 7, 2025):

I figured out the source of the issue: it occurs when building (bun build) opencode with bun 1.2.21 (instead of previously 1.2.20). Bun 1.2.21 introduces --compile-exec-argv which has to be set to "--" to achieve the same behavior as before (see the changelog https://bun.sh/blog/bun-v1.2.21#embed-runtime-flags-into-standalone-executables-with-compile-exec-argv). Though, I'm not sure if this is the intended behavior of this flag. PR has been merged (see https://github.com/NixOS/nixpkgs/pull/440598).

I think this issue can be closed, since this has nothing to do with opencode.

@delafthi commented on GitHub (Sep 7, 2025): I figured out the source of the issue: it occurs when building (`bun build`) opencode with bun 1.2.21 (instead of previously 1.2.20). Bun 1.2.21 introduces `--compile-exec-argv` which has to be set to `"--"` to achieve the same behavior as before (see the changelog https://bun.sh/blog/bun-v1.2.21#embed-runtime-flags-into-standalone-executables-with-compile-exec-argv). Though, I'm not sure if this is the intended behavior of this flag. PR has been merged (see https://github.com/NixOS/nixpkgs/pull/440598). I think this issue can be closed, since this has nothing to do with opencode.
Author
Owner

@rekram1-node commented on GitHub (Sep 7, 2025):

sounds good I will close for now

@rekram1-node commented on GitHub (Sep 7, 2025): sounds good I will close for now
Author
Owner

@Ninja3047 commented on GitHub (Sep 7, 2025):

This was fixed upstream but is not in a release https://github.com/oven-sh/bun/pull/22169 (yet)
imo it's a regression in bun

@Ninja3047 commented on GitHub (Sep 7, 2025): This was fixed upstream but is not in a release https://github.com/oven-sh/bun/pull/22169 (yet) imo it's a regression in bun
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#1644