{"record":{"id":"08da375027aef7fd","repo":"gastownhall/beads","slug":"nix-not-found-in-path-manual-fix-1-edit-de","errorCode":null,"errorMessage":"nix not found in PATH\n  Manual fix:\n    1. Edit default.nix: set vendorHash = \"sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=\"\n    2. Run: nix build .#default\n    3. Copy the 'got:' hash from the error into default.nix","messagePattern":"nix not found in PATH\n  Manual fix:\n    1\\. Edit default\\.nix: set vendorHash = \"sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=\"\n    2\\. Run: nix build \\.#default\n    3\\. Copy the 'got:' hash from the error into default\\.nix","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/preflight.go","lineNumber":744,"sourceCode":"\t}\n\treturn nil\n}\n\n// fixNixHash computes and updates the vendorHash in default.nix.\n// It uses a sentinel hash to trigger nix to report the correct hash.\n// Returns (fixed, oldHash, newHash, err).\nfunc fixNixHash() (bool, string, string, error) {\n\t// Check if go.sum has uncommitted changes (same heuristic as runNixHashCheck)\n\tcmd1 := exec.Command(\"git\", \"diff\", \"--name-only\", \"HEAD\", \"--\", \"go.sum\")\n\tout1, _ := cmd1.Output()\n\tcmd2 := exec.Command(\"git\", \"diff\", \"--name-only\", \"--cached\", \"--\", \"go.sum\")\n\tout2, _ := cmd2.Output()\n\tif len(strings.TrimSpace(string(out1))) == 0 && len(strings.TrimSpace(string(out2))) == 0 {\n\t\treturn false, \"\", \"\", nil\n\t}\n\n\tif _, err := exec.LookPath(\"nix\"); err != nil {\n\t\treturn false, \"\", \"\", fmt.Errorf(\n\t\t\t\"nix not found in PATH\\n  Manual fix:\\n\" +\n\t\t\t\t\"    1. Edit default.nix: set vendorHash = \\\"sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=\\\"\\n\" +\n\t\t\t\t\"    2. Run: nix build .#default\\n\" +\n\t\t\t\t\"    3. Copy the 'got:' hash from the error into default.nix\",\n\t\t)\n\t}\n\n\tnixPath := \"default.nix\"\n\tnixInfo, err := os.Stat(nixPath)\n\tif err != nil {\n\t\treturn false, \"\", \"\", fmt.Errorf(\"cannot stat default.nix: %v\", err)\n\t}\n\tnixPerm := nixInfo.Mode().Perm()\n\n\tcontent, err := os.ReadFile(nixPath)\n\tif err != nil {\n\t\treturn false, \"\", \"\", fmt.Errorf(\"cannot read default.nix: %v\", err)\n\t}","sourceCodeStart":726,"sourceCodeEnd":762,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/preflight.go#L726-L762","documentation":"During `bd fix` preflight repairs, fixNixHash probes the Nix vendor hash used by default.nix. Before running any nix build it checks that the `nix` executable is on PATH via exec.LookPath; if absent, it returns this error containing step-by-step manual fix instructions instead of attempting the automated fix.","triggerScenarios":"Running `bd fix` (runFixes) on a machine where the Nix package manager is not installed or is not on PATH, while a Nix vendorHash fix is needed (vendorHash mismatch detected).","commonSituations":"CI container or fresh machine without Nix installed; Nix installed via a multi-user setup whose binaries live outside the current PATH (e.g. /nix/var/nix/profiles/... not linked); running bd inside a sandbox that strips PATH.","solutions":["Install Nix (e.g. `sh <(curl -L https://nixos.org/nix/install)`), then re-run `bd fix`","If Nix is installed but not found, add its bin directory to PATH (e.g. `export PATH=$PATH:/nix/var/nix/profiles/per-user/$USER/profile/bin` or source /etc/profile.d/nix.sh)","Follow the manual steps printed in the error: set vendorHash to the all-A sentinel in default.nix, run `nix build .#default`, copy the 'got:' hash back into default.nix"],"exampleFix":"// before (error)\nnix not found in PATH\n// after\nexport PATH=\"$PATH:/nix/var/nix/profiles/per-user/$USER/profile/bin\"\nbd fix","handlingStrategy":"validation","validationCode":"command -v nix >/dev/null 2>&1 || { echo \"nix required: install https://nixos.org/download\"; exit 1; }","typeGuard":null,"tryCatchPattern":"out, err := exec.Command(\"bd\", \"fix\").CombinedOutput()\nif err != nil && strings.Contains(string(out), \"nix not found in PATH\") {\n    // install nix or extend PATH, then retry\n}","preventionTips":["Install Nix in your dev image / CI container before running bd fix","Add nix's bin dir to PATH in shell profile or CI setup steps","Prefer the manual fallback steps from the error message when Nix cannot be installed"],"tags":["nix","path","environment","build","cli"],"backgroundTag":"command-not-found-in-path","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}