Skip to content

Nix: v2.2.0 build fails with node_modules hash mismatch #59882

Description

@clementpoiret

Description

Updating to v2.2.0 broke my NixOS CI build with a node_modules hash mismatch. Reproduced on dev (950111f):

specified: sha256-WTBGUXIj/+CCJMQxunNpRfFY+0f3QyEoRUACwlnXMTU=
got:       sha256-I3JJjXdMbFpG+6gmecbFpPA67b6pdGey0tTmV3ciE0c=

Dependency changes merge before the hash bot updates nix/hashes.json, while check-nix.yml only evaluates derivations. Please build dependencies in required PR checks and before releases, including on hash-bot PRs.

Plugins

No response

OpenCode version

v2.2.0

Steps to reproduce

  1. Try install the pinned v2.2.0 release using the flake

Screenshot

No response

Operating System

NixOS

Terminal

No response

Activity

  1. opencodejr commented on Oct 28, 2026

    @opencodejr
    Contributor

    Thanks for the report. I could reproduce the hash mismatch on dev, but not on the v2.2.0 tag itself.

    I used Nix 2.35.4 on x86_64-linux, building with the flake's own flake.lock (no inputs.nixpkgs.follows):

    • v2.2.0 (1097e26): nix build .#opencode.node_modules succeeds with the pinned hash. The full nix build .#opencode also succeeds and reports opencode v2.2.0+1097e26.
    • Latest dev (950111f): nix build .#opencode.node_modules fails with exactly your hashes (specified: sha256-WTBGUXIj…, got: sha256-I3JJjXdM…). nix/hashes.json on dev is stale. The hash-bot PR chore: update nix node_modules hashes #59827, still open, is meant to update it.

    The script below runs both builds.

    If your CI fails on the v2.2.0 tag, does your flake set inputs.opencode.inputs.nixpkgs.follows? A different nixpkgs brings a different bun version, which changes the node_modules hash (#49063). That would explain a mismatch on the release even when the pinned hash is correct for the flake's own inputs.

    Related:

    Reproduction script (repro.sh)
    #!/usr/bin/env bash
    # Reproduces #59882: the Nix node_modules fixed-output derivation hash in
    # nix/hashes.json is stale on `dev`, while the v2.2.0 tag builds fine.
    # Needs Nix with flakes enabled (nix-command flakes), x86_64-linux.
    set -u
    REPO=${REPO:-https://github.com/anomalyco/opencode}
    
    echo "== v2.2.0 tag (flake's own nixpkgs lock) =="
    nix build --no-link --print-build-logs "git+${REPO}?ref=refs/tags/v2.2.0#opencode.node_modules" 2>&1 | grep -iA2 "mismatch" \
      || echo "v2.2.0 node_modules: built OK with pinned hash"
    
    echo "== dev =="
    nix build --no-link --print-build-logs "git+${REPO}?ref=dev#opencode.node_modules" 2>&1 | grep -iA2 "mismatch" \
      || echo "dev node_modules: built OK with pinned hash"

    Run it: bash repro.sh

  2. clementpoiret commented on Nov 2, 2026

    @clementpoiret
    Author

    For context, il happens to nearly all releases, making opencode hard to install on NixOS using the flake. E.g., current v2.2.5 is also broken

  3. mplibunao commented on Nov 2, 2026

    @mplibunao

    Also seeing this on aarch64-darwin (macOS 26.6.2, Determinate Nix 3.15.0 / Nix 2.33.0) with v2.2.3 and v2.2.5. I'm building from the tags with the flake's own lock, no follows:

    v2.2.3  specified: sha256-ie3dihmkL/U4kPw+hKyVNj8uryed9mxGEiq8VpxMMIc=
            got:       sha256-Uv2AFVqJHbAG2zlIEieSSUY616pyda9yxB4gUwFKYm0=
    v2.2.5  specified: sha256-rb8stm2Va+SkGrZXeCYDwFvrKtpsRnggQeBp5p8NPYY=
            got:       sha256-bp2jsa4iX5jX4O3vWQC9TRSwsAtnkzXX86O90NaJdq8=
    

    Looks like the same cause described above. The v2.2.5 tag still has the nix/hashes.json from 85d7397, and bun.lock changed in the 20 commits after that.

    Would it be possible to update the hashes before tagging a release? Then the tagged flake would build as-is. For now I'm overriding the node_modules hash locally.

  4. clementpoiret commented on Nov 2, 2026

    @clementpoiret
    Author

    I made a PR to fix this, I'm waiting for the final review, but I think #59403 may solve this entirely

  5. machineonamission commented on Nov 3, 2026

    @machineonamission

    i also am experiencing this

    error: hash mismatch in fixed-output derivation '/nix/store/bz20za9y1pyrdyb4ihpknp75x6lb5qzm-opencode-node_modules-2.2.5+d9184f2.drv':
             specified: sha256-UOVs48Z4yO4TJv859cg89lsul54KB9StTSl/VSQJXmc=
                got:    sha256-BQe0j5I0tQfMHeodH1O0MlWeJhMgCyoJdb9u3QeVfFg=
    

    suspiciously, the way the repo generatres these very hashes changed from opencode-agent to github-actions recently, and i have to wonder if the gh actions hasher is broken?

    Image

    https://github.com/anomalyco/opencode/commits/production/nix/hashes.json

  6. added a commit that references this issue on Nov 5, 2026
  7. NoobInTheNet commented on Nov 10, 2026

    @NoobInTheNet

    Same on v2.2.6 (dc2ffcf) on aarch64-darwin, building the tag with the flake's own lock (no follows):

    error: hash mismatch in fixed-output derivation 'opencode-node_modules-2.2.6+dc2ffcf.drv':
             specified: sha256-AU2AUkdlL1g+hBkMZX93gQeQy6u8F0Gyzuk48yoN8as=
                got:    sha256-KKBjcy7DhWMxNR+hGWkpp90D60YIFCfjRFQuiPYymAY=
    

    The aarch64-darwin value in nix/hashes.json is the same on dev today, so the tag does not build from the flake on this platform. v2.1.2 builds.

  8. clementpoiret commented on Nov 10, 2026

    @clementpoiret
    Author

    For those in need, this is the kind of override you need in your nixos config:

            opencode = opencode.packages.${system}.default.overrideAttrs (
              old:
              pkgs-unstable.lib.optionalAttrs
                (old.version == "2.2.6+dc2ffcf" && pkgs-unstable.bun.version == "1.4.4")
                {
                  # This release's upstream hash differs with Bun 1.4.4; local and CI outputs match.
                  node_modules = old.node_modules.override {
                    hash = "sha256-O2hF8pGUSArKgYBeP99oOW3iXVVZl5bV5WPTp3E7JIA=";
                  };
                }
            );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions