{"record":{"id":"cfe0dc776bef797a","repo":"oven-sh/bun","slug":"failed-to-get-release-info-for-tag-error","errorCode":null,"errorMessage":"Failed to get release info for ${tag}: ${error}","messagePattern":"Failed to get release info for (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/github-metrics.ts","lineNumber":35,"sourceCode":"  content: string;\n}\n\ninterface Comment {\n  id: number;\n}\n\n/**\n * Get release information for a given tag\n */\nasync function getReleaseInfo(tag: string): Promise<ReleaseInfo> {\n  try {\n    const result = await $`gh release view ${tag} --json publishedAt,tagName`.json();\n    return {\n      publishedAt: result.publishedAt,\n      tag: result.tagName,\n    };\n  } catch (error) {\n    throw new Error(`Failed to get release info for ${tag}: ${error}`);\n  }\n}\n\n/**\n * Count issues closed as completed since a given date\n */\nasync function countCompletedIssues(sinceDate: string): Promise<{ count: number; issues: number[] }> {\n  try {\n    const result =\n      (await $`gh issue list --state closed --search \"closed:>=${sinceDate} reason:completed\" --limit 1000 --json number,closedAt,stateReason`.json()) as Issue[];\n\n    const completedIssues = result.filter(issue => issue.stateReason === \"COMPLETED\");\n\n    return {\n      count: completedIssues.length,\n      issues: completedIssues.map(issue => issue.number),\n    };\n  } catch (error) {","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/oven-sh/bun/blob/8c5296ac459e8252d3cd702f3fbcbb0c249d95d5/scripts/github-metrics.ts#L17-L53","documentation":"Thrown by getReleaseInfo() in scripts/github-metrics.ts when the underlying `gh release view <tag> --json publishedAt,tagName` shell call fails. The script wraps GitHub's official CLI, so any CLI-level failure is re-thrown as this Error with the original gh message appended after the tag.","triggerScenarios":"Calling getReleaseInfo(tag) with a tag that has no GitHub Release object; gh not installed or `gh auth status` failing (no GH_TOKEN/GITHUB_TOKEN in CI); API rate limiting or network failure while gh talks to api.github.com.","commonSituations":"CI job where the token env var isn't exported to the gh process; a git tag exists but no GitHub Release was published for it; running the metrics script on a laptop that never ran `gh auth login`.","solutions":["Confirm the release exists: run `gh release view <tag> --repo oven-sh/bun` manually","Check auth: `gh auth status`; in CI export GH_TOKEN or GITHUB_TOKEN","If the tag has no Release, create one (`gh release create <tag>`) or point the script at an existing release tag","Re-run after fixing network/rate-limit (secondary rate limits resolve in ~1h)"],"exampleFix":"// before\nconst info = await getReleaseInfo(tag);\n\n// after\nconst check = Bun.spawnSync(['gh', 'release', 'view', tag, '--repo', 'oven-sh/bun']);\nif (check.exitCode !== 0) {\n  console.error(`No GitHub release for ${tag}; skipping metrics`);\n  process.exit(1);\n}\nconst info = await getReleaseInfo(tag);","handlingStrategy":"validation","validationCode":"// Verify gh is usable and the release exists before calling getReleaseInfo\nawait $`gh auth status`.quiet();\nconst releases = await $`gh release list --repo oven-sh/bun --limit 100 --json tagName`.json();\nconst tags = new Set(releases.map(r => r.tagName));\nif (!tags.has(tag)) {\n  throw new Error(`tag ${tag} has no GitHub release; create one first`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  const info = await getReleaseInfo(tag);\n} catch (error) {\n  if (/not found/i.test(String(error))) {\n    // permanent: tag has no release — skip or create it\n  } else {\n    // transient: auth/network/rate-limit — fix env and retry\n  }\n}","preventionTips":["Always export GH_TOKEN/GITHUB_TOKEN in CI steps that shell out to gh","Publish the GitHub Release before running the metrics script","Run `gh auth status` as a first CI step to fail fast on auth"],"tags":["github-cli","release","ci","network"],"backgroundTag":null,"analyzedSha":"8c5296ac459e8252d3cd702f3fbcbb0c249d95d5","analyzedAt":"2026-08-16T08:01:58.794Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}