vectordotdev/vector · error

` ` failed (exit )

Error message

`{display}` failed (exit {}):
{}{}

What it means

This error is thrown by `run_command` in vdev's release CUE generation when an external shell command (git, gh, etc.) exits with a non-zero status. It wraps the command's exit status plus its captured stdout and stderr so the developer can see exactly why the subprocess failed. It is a generic subprocess-failure gate used throughout the release pipeline.

Solutions

  1. Read the embedded stdout/stderr in the message to see the underlying command's failure reason.
  2. Re-run the exact command manually in the repo root to reproduce and diagnose.
  3. If it is a git command failure, check remote connectivity and that the clone is not shallow (git fetch --unshallow).
  4. If it is a gh command failure, run `gh auth status` and authenticate with `gh auth login`.
  5. Fix the underlying condition and re-run `vdev release generate-cue`.

Example fix

// before: release script fails on shallow clone
$ vdev release generate-cue
`git log` failed (exit 128): fatal: your current branch 'master' does not have any commits yet
// after: give git full history first
$ git fetch --unshallow
$ vdev release generate-cue
Defensive patterns

Strategy: try-catch

Validate before calling

// before invoking release tooling, sanity-check prerequisites
which git gh cue || echo "missing tool"
gh auth status || gh auth login
git rev-parse --is-shallow-repository # must print false

Try / catch

match run_result {
    Err(e) if e.to_string().contains("failed (exit") => {
        eprintln!("subprocess failed: {e:#}; fix the command's stdout/stderr above and retry");
    }
    Err(e) => return Err(e),
    Ok(v) => v,
}

Prevention

When it happens

Trigger: Any command invoked via run_command (from lookup_pull_requests_from_git, ensure_full_git_history, pull_request_lookup_includes_renamed_fragment_commit, prepare_vector_version, pin_vrl_version, or append_vrl_changelog_to_release_cue) returns a non-zero exit code, e.g. `git fetch` fails, `gh pr list` is unauthenticated, or the GitHub API rate-limits.

Common situations: Running release preparation without `gh` authenticated (`gh auth login` missing), a shallow git clone so ensure_full_git_history must rewrite history, network outage or GitHub rate limiting during PR lookup, or a dirty/unexpected git state in the repo.

Understand the failure class

Background: "git command failed": what it means when a tool shells out to git and git exits non-zero — this error's family across 21 libraries.

Related errors


AI-assisted analysis of vectordotdev/vector@0d4ab78a4f (2026-09-16). Data as JSON: /api/errors/0046a5077223597b. Report an issue: GitHub.

Appendix: source

Thrown at vdev/src/commands/release/generate_cue.rs:552

    Ok(())
}

#[cfg(test)]
fn lookup_pull_requests(_: &Path, _: &Path, _: PullRequestMetadata) -> Result<Vec<u64>> {
    // Unit tests exercise local parsing and rendering without requiring a Git repository.
    Ok(vec![42])
}

fn run_command(cmd: &str, args: &[&str], cwd: &Path) -> Result<String> {
    let display = format!("{cmd} {}", args.join(" "));
    let output = Command::new(cmd)
        .args(args)
        .current_dir(cwd)
        .output()
        .with_context(|| format!("Failed to run `{display}`"))?;

    if !output.status.success() {
        bail!(
            "`{display}` failed (exit {}):\n{}{}",
            output.status,
            String::from_utf8_lossy(&output.stdout),
            String::from_utf8_lossy(&output.stderr),
        );
    }

    Ok(String::from_utf8_lossy(&output.stdout).into_owned())
}

/// Split off the trailing `authors: <handles...>` line, returning the body preceding it
/// (as a slice into `raw`) plus the parsed handle list. Works with both LF and CRLF line
/// endings — we locate the marker directly in the original byte stream rather than
/// reconstructing offsets from `str::lines()`.
fn split_authors(raw: &str) -> (&str, Vec<String>) {
    let trimmed = raw.trim_end_matches(['\n', '\r']);
    let (body_end, handles_start) = match trimmed.rfind("\nauthors: ") {
        Some(nl) => (nl, nl + 1),

View on GitHub (pinned to 0d4ab78a4f)