{"record":{"id":"e458f44d16141caa","repo":"vectordotdev/vector","slug":"gh-api-changelog-md-failed-stderr","errorCode":null,"errorMessage":"gh api CHANGELOG.md failed: {stderr}","messagePattern":"gh api CHANGELOG\\.md failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"vdev/src/commands/release/prepare.rs","lineNumber":362,"sourceCode":"\n    result.join(\"\\n\")\n}\n\nfn get_vrl_changelog(version: &Version) -> Result<String> {\n    let tag = format!(\"v{version}\");\n    let changelog_output = Command::new(\"gh\")\n        .args([\n            \"api\",\n            &format!(\"repos/vectordotdev/vrl/contents/CHANGELOG.md?ref={tag}\"),\n            \"-H\",\n            \"Accept: application/vnd.github.raw+json\",\n        ])\n        .output()\n        .context(\"Failed to run `gh api` for VRL CHANGELOG.md\")?;\n\n    if !changelog_output.status.success() {\n        let stderr = String::from_utf8_lossy(&changelog_output.stderr);\n        bail!(\"gh api CHANGELOG.md failed: {stderr}\");\n    }\n\n    let changelog =\n        String::from_utf8(changelog_output.stdout).context(\"CHANGELOG.md is not valid UTF-8\")?;\n\n    // Extract the first release section (from the first ## to the next ##)\n    let mut section = Vec::new();\n    let mut found_first = false;\n    for line in changelog.lines() {\n        if line.starts_with(\"## \") {\n            if found_first {\n                break;\n            }\n            found_first = true;\n        }\n        if found_first {\n            section.push(line);\n        }","sourceCodeStart":344,"sourceCodeEnd":380,"githubUrl":"https://github.com/vectordotdev/vector/blob/0d4ab78a4f0d9c9e5d03a50108a2ae4d2f4b2460/vdev/src/commands/release/prepare.rs#L344-L380","documentation":"`get_vrl_changelog` fetches the VRL repository's CHANGELOG.md via `gh api` and bails when the gh subprocess reports failure, surfacing gh's stderr. This usually means the repo argument is wrong, gh is unauthenticated, or the network/API call failed while building the VRL changelog appendix for the release notes.","triggerScenarios":"`gh api repos/<owner>/<vrl-repo>/contents/CHANGELOG.md` (or equivalent) exits non-zero during append_vrl_changelog_to_release_cue — e.g. bad repo name, expired gh token, rate limit, or no network.","commonSituations":"gh CLI not logged in (`gh auth login` missing) or token scopes reduced, GitHub API rate limit exceeded (403 with rate-limit message in stderr), or the VRL repo slug in the prepare arguments is misspelled or renamed.","solutions":["Read the stderr embedded in the message for gh's exact HTTP/status reason.","Run `gh auth status` and re-authenticate with `gh auth login` if the token is missing/expired.","If rate-limited, wait for the limit window to reset or use a token with a higher quota, then re-run.","Verify the VRL repo slug/arguments passed to `vdev release prepare` are correct.","Re-run prepare once the gh API call succeeds."],"exampleFix":"// before: unauthenticated gh\ngh api CHANGELOG.md failed: gh: To use GitHub CLI in a GitHub Actions workflow, set the GH_TOKEN environment variable\n// after\n$ gh auth login\n$ vdev release prepare 0.46.0 0.12.0","handlingStrategy":"retry","validationCode":"# preflight the gh API call used for the VRL changelog\ngh auth status && gh api repos/vectordotdev/vrl/contents/CHANGELOG.md --jq .name || echo \"gh API unavailable\"","typeGuard":null,"tryCatchPattern":"match get_vrl_changelog(...) {\n    Err(e) if e.to_string().starts_with(\"gh api CHANGELOG.md failed\") => {\n        // inspect stderr: 401/403 -> auth or rate limit; 404 -> wrong repo\n        eprintln!(\"gh error: {e}; re-auth or wait out the rate limit, then retry\");\n    }\n    r => r?,\n}","preventionTips":["Refresh gh credentials before release day.","Use a token with adequate rate-limit headroom in CI (GH_TOKEN).","Verify repo slugs in release arguments.","Retry with backoff on 403 rate-limit responses."],"tags":["github","gh-cli","subprocess","release"],"backgroundTag":"http-error-response","analyzedSha":"0d4ab78a4f0d9c9e5d03a50108a2ae4d2f4b2460","analyzedAt":"2026-09-16T02:53:35.741Z","contentChangedAt":"2026-09-16T02:53:35.741Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}