{"record":{"id":"9f2db1c125a011d4","repo":"gastownhall/beads","slug":"gh-cli-not-installed","errorCode":null,"errorMessage":"gh CLI not installed","messagePattern":"gh CLI not installed","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/gate.go","lineNumber":1074,"sourceCode":"\treturn checkGHRunStatusInRepo(runID, \"\")\n}\n\nfunc checkGHRunStatusInRepo(runID, repo string) (resolved, escalated bool, reason string, err error) {\n\treturn checkGHRunStatusInRepoWithRunner(runID, repo, runGHCommand)\n}\n\nfunc checkGHRunStatusInRepoWithRunner(runID, repo string, runGH ghCommandRunner) (resolved, escalated bool, reason string, err error) {\n\t// Run: gh run view <id> --json status,conclusion,name\n\targs := []string{\"run\", \"view\", runID, \"--json\", \"status,conclusion,name\"}\n\tif repo != \"\" {\n\t\targs = append(args, \"--repo\", repo)\n\t}\n\tstdout, stderr, runErr := runGH(args...)\n\tif runErr != nil {\n\t\t// Check if gh CLI is not found\n\t\tif strings.Contains(string(stderr), \"command not found\") ||\n\t\t\tstrings.Contains(runErr.Error(), \"executable file not found\") {\n\t\t\treturn false, false, \"\", fmt.Errorf(\"gh CLI not installed\")\n\t\t}\n\t\t// Check if run not found\n\t\tif strings.Contains(string(stderr), \"not found\") {\n\t\t\treturn false, true, \"workflow run not found\", nil\n\t\t}\n\t\treturn false, false, \"\", fmt.Errorf(\"gh run view failed: %s\", string(stderr))\n\t}\n\n\tvar status ghRunStatus\n\tif parseErr := json.Unmarshal(stdout, &status); parseErr != nil {\n\t\treturn false, false, \"\", fmt.Errorf(\"failed to parse gh output: %w\", parseErr)\n\t}\n\n\t// Evaluate status\n\tswitch status.Status {\n\tcase \"completed\":\n\t\tswitch status.Conclusion {\n\t\tcase \"success\":","sourceCodeStart":1056,"sourceCodeEnd":1092,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/gate.go#L1056-L1092","documentation":"Returned by checkGHRunStatusInRepoWithRunner when the `gh` executable cannot be found (cmd/bd/gate.go:1074). It detects 'command not found' in stderr or 'executable file not found' in the runner error and reports that the GitHub CLI is missing rather than a gh-level failure.","triggerScenarios":"A gh:run gate is evaluated and runGH fails because the `gh` binary is absent from PATH (not installed, wrong PATH in the service/agent environment).","commonSituations":"CI container or server without gh installed, PATH not set for daemonized processes, gh installed via a version manager whose shims aren't on the service PATH.","solutions":["Install the GitHub CLI (https://cli.github.com) e.g. `brew install gh` or the apt/deb package","Verify `which gh` / `gh --version` works in the same environment bd runs in","Fix PATH for the service user/daemon so the gh binary is discoverable","Ensure `gh auth login` was completed after install"],"exampleFix":"// before (CI container)\n# no gh\n// after\nRUN apt-get update && apt-get install -y gh && gh auth login --with-token","handlingStrategy":"validation","validationCode":"if _, err := exec.LookPath(\"gh\"); err != nil {\n    return errors.New(\"gh CLI must be installed and on PATH before using gh:run gates\")\n}","typeGuard":null,"tryCatchPattern":"if _, _, _, err := checkGHRun(gate); err != nil && err.Error() == \"gh CLI not installed\" {\n    // fail fast with install instructions; do not retry\n}","preventionTips":["Install gh in every environment bd runs in (include in container images)","Check `which gh` in entrypoint/startup scripts","Keep service PATH aligned with interactive shell PATH"],"tags":["gh-cli","missing-binary","environment"],"backgroundTag":"gh-cli-not-installed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}