vectordotdev/vector · error

Error running `git describe

Error message

Error running `git describe`:
{error}

What it means

vdev (Vector's dev CLI) computes the version for the release channel by running `git describe` via utils::git::git_head. If that git command fails (non-zero exit), the tool aborts with "Error running `git describe`:" followed by git's stderr. It indicates the repo state does not allow describing the HEAD, not a code problem.

Solutions

  1. Run the command from the root of a full clone: ensure `git describe` succeeds manually first.
  2. Fetch tags so describe can resolve a version: `git fetch --tags --force`.
  3. If building from a tarball, clone the repo instead of using the archive.
  4. Inspect the stderr printed after the message to fix the underlying git failure (e.g. safe.directory, ownership, missing git).

Example fix

// before (CI shallow checkout)
- uses: actions/checkout@v4
  with: { fetch-depth: 1 }
// after
- uses: actions/checkout@v4
  with: { fetch-depth: 0 }
- run: git fetch --tags --force
Defensive patterns

Strategy: validation

Validate before calling

# Ensure vdev prerequisites before release commands
git rev-parse --is-inside-work-tree || { echo "not a git repo"; exit 1; }
git fetch --tags --force
git describe --tags >/dev/null || { echo "git describe failed"; exit 1; }

Try / catch

// Wrap vdev release invocations and surface stderr
if ! cargo vdev <release-cmd>; then
  echo "vdev failed; check git repo state and tags" >&2
  exit 1
fi

Prevention

When it happens

Trigger: Running a vdev release/version command inside a directory that is not a git repository or a worktree; a repo with no commits or no tags such that `git describe` errors; corrupted .git or missing git binary producing a failed invocation.

Common situations: Building from a source tarball or shallow CI checkout without tags; running vdev in a Docker context that excludes .git; detached checkouts with fetched history pruned of tags.

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@bdb87aeaa4 (2026-09-16). Data as JSON: /api/errors/ee828602899dc8be. Report an issue: GitHub.

Appendix: source

Thrown at vdev/src/app.rs:56

pub fn path() -> &'static String {
    PATH.get().expect("path is not initialized")
}

pub fn set_repo_dir() -> Result<()> {
    env::set_current_dir(path()).context("Could not change directory")
}

pub fn version() -> Result<String> {
    let mut version = utils::cargo::get_version()?;

    let channel = utils::git::get_channel();

    if channel == "release" {
        let head = utils::git::git_head()?;
        if !head.status.success() {
            let error = String::from_utf8_lossy(&head.stderr);
            bail!("Error running `git describe`:\n{error}");
        }
        let tag = String::from_utf8_lossy(&head.stdout).trim().to_string();
        if tag != format!("v{version}") {
            bail!(
                "On latest release channel and tag {tag:?} is different from Cargo.toml {version:?}. Aborting"
            );
        }

    // extend version for custom builds if not already
    } else if channel == "custom" && !version.contains("custom") {
        let sha = utils::git::get_git_sha()?;

        // use '.' instead of '-' or '_' to avoid issues with rpm and deb package naming
        // format requirements.
        version = format!("{version}.custom.{sha}");
    }

    Ok(version)

View on GitHub (pinned to bdb87aeaa4)