vectordotdev/vector · error
gh api CHANGELOG.md failed
Error message
gh api CHANGELOG.md failed: {stderr} What it means
`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.
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.
Example fix
// before: unauthenticated gh gh api CHANGELOG.md failed: gh: To use GitHub CLI in a GitHub Actions workflow, set the GH_TOKEN environment variable // after $ gh auth login $ vdev release prepare 0.46.0 0.12.0
Defensive patterns
Strategy: retry
Validate before calling
# preflight the gh API call used for the VRL changelog gh auth status && gh api repos/vectordotdev/vrl/contents/CHANGELOG.md --jq .name || echo "gh API unavailable"
Try / catch
match get_vrl_changelog(...) {
Err(e) if e.to_string().starts_with("gh api CHANGELOG.md failed") => {
// inspect stderr: 401/403 -> auth or rate limit; 404 -> wrong repo
eprintln!("gh error: {e}; re-auth or wait out the rate limit, then retry");
}
r => r?,
} Prevention
- 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.
When it happens
Trigger: `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.
Common situations: 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.
Understand the failure class
Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.
Related errors
- Could not find version
- cue fmt exited with
- ` ` failed (exit )
- Error running `git describe
- expected package version
AI-assisted analysis of vectordotdev/vector@0d4ab78a4f (2026-09-16).
Data as JSON: /api/errors/e458f44d16141caa.
Report an issue: GitHub.
Appendix: source
Thrown at vdev/src/commands/release/prepare.rs:362
result.join("\n")
}
fn get_vrl_changelog(version: &Version) -> Result<String> {
let tag = format!("v{version}");
let changelog_output = Command::new("gh")
.args([
"api",
&format!("repos/vectordotdev/vrl/contents/CHANGELOG.md?ref={tag}"),
"-H",
"Accept: application/vnd.github.raw+json",
])
.output()
.context("Failed to run `gh api` for VRL CHANGELOG.md")?;
if !changelog_output.status.success() {
let stderr = String::from_utf8_lossy(&changelog_output.stderr);
bail!("gh api CHANGELOG.md failed: {stderr}");
}
let changelog =
String::from_utf8(changelog_output.stdout).context("CHANGELOG.md is not valid UTF-8")?;
// Extract the first release section (from the first ## to the next ##)
let mut section = Vec::new();
let mut found_first = false;
for line in changelog.lines() {
if line.starts_with("## ") {
if found_first {
break;
}
found_first = true;
}
if found_first {
section.push(line);
}View on GitHub (pinned to 0d4ab78a4f)