gastownhall/beads · error
gh run view failed: %s
Error message
gh run view failed: %s
What it means
Returned when `gh run view <id> --json ...` exits non-zero for a reason other than missing CLI or missing run (cmd/bd/gate.go:1080). The message carries gh's raw stderr so the developer can see the actual gh failure.
Source
Thrown at cmd/bd/gate.go:1080
func checkGHRunStatusInRepoWithRunner(runID, repo string, runGH ghCommandRunner) (resolved, escalated bool, reason string, err error) {
// Run: gh run view <id> --json status,conclusion,name
args := []string{"run", "view", runID, "--json", "status,conclusion,name"}
if repo != "" {
args = append(args, "--repo", repo)
}
stdout, stderr, runErr := runGH(args...)
if runErr != nil {
// Check if gh CLI is not found
if strings.Contains(string(stderr), "command not found") ||
strings.Contains(runErr.Error(), "executable file not found") {
return false, false, "", fmt.Errorf("gh CLI not installed")
}
// Check if run not found
if strings.Contains(string(stderr), "not found") {
return false, true, "workflow run not found", nil
}
return false, false, "", fmt.Errorf("gh run view failed: %s", string(stderr))
}
var status ghRunStatus
if parseErr := json.Unmarshal(stdout, &status); parseErr != nil {
return false, false, "", fmt.Errorf("failed to parse gh output: %w", parseErr)
}
// Evaluate status
switch status.Status {
case "completed":
switch status.Conclusion {
case "success":
return true, false, fmt.Sprintf("workflow '%s' succeeded", status.Name), nil
case "failure":
return false, true, fmt.Sprintf("workflow '%s' failed", status.Name), nil
case "cancelled", "canceled":
return false, true, fmt.Sprintf("workflow '%s' was canceled", status.Name), nil
case "skipped":View on GitHub (pinned to 71377f2769)
Solutions
- Inspect the stderr text embedded in this error for the exact gh message
- Run the same command manually: `gh run view <id> --repo <owner/repo>`
- Re-authenticate: `gh auth status` then `gh auth login`
- Check repo permissions for the token and confirm the repo slug is correct
Defensive patterns
Strategy: retry
Validate before calling
gh auth status && gh repo view <owner/repo> --json name
Try / catch
if _, _, _, err := checkGHRunStatus(runID); err != nil && strings.HasPrefix(err.Error(), "gh run view failed:") {
// inspect embedded stderr; retry with backoff for transient 5xx/rate-limit
} Prevention
- Keep gh authenticated with adequate token scopes
- Respect rate limits; add backoff on repeated gate checks
- Verify repo slugs in gate metadata
When it happens
Trigger: checkGHRunStatusInRepoWithRunner runs `gh run view` and it fails with stderr that contains neither 'command not found' nor 'not found' — e.g. auth errors, rate limits, invalid repo, permission denial.
Common situations: Token lacks access to the target repo (cross-repo gate), GitHub API 403/rate limit, gh not authenticated, invalid --repo slug, network/proxy failure.
Related errors
- failed to query workflow runs: %w
- no runs found for workflow '%s'
- gh pr view failed: %s
- gh CLI not installed
- failed to parse gh output: %w
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/de128032a90f36c3.
Report an issue: GitHub.