{"record":{"id":"ee828602899dc8be","repo":"vectordotdev/vector","slug":"error-running-git-describe-error","errorCode":null,"errorMessage":"Error running `git describe`:\n{error}","messagePattern":"Error running `git describe`:\n(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"vdev/src/app.rs","lineNumber":56,"sourceCode":"\npub fn path() -> &'static String {\n    PATH.get().expect(\"path is not initialized\")\n}\n\npub fn set_repo_dir() -> Result<()> {\n    env::set_current_dir(path()).context(\"Could not change directory\")\n}\n\npub fn version() -> Result<String> {\n    let mut version = utils::cargo::get_version()?;\n\n    let channel = utils::git::get_channel();\n\n    if channel == \"release\" {\n        let head = utils::git::git_head()?;\n        if !head.status.success() {\n            let error = String::from_utf8_lossy(&head.stderr);\n            bail!(\"Error running `git describe`:\\n{error}\");\n        }\n        let tag = String::from_utf8_lossy(&head.stdout).trim().to_string();\n        if tag != format!(\"v{version}\") {\n            bail!(\n                \"On latest release channel and tag {tag:?} is different from Cargo.toml {version:?}. Aborting\"\n            );\n        }\n\n    // extend version for custom builds if not already\n    } else if channel == \"custom\" && !version.contains(\"custom\") {\n        let sha = utils::git::get_git_sha()?;\n\n        // use '.' instead of '-' or '_' to avoid issues with rpm and deb package naming\n        // format requirements.\n        version = format!(\"{version}.custom.{sha}\");\n    }\n\n    Ok(version)","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/vectordotdev/vector/blob/bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013/vdev/src/app.rs#L38-L74","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Run the command from the root of a full clone: ensure `git describe` succeeds manually first.","Fetch tags so describe can resolve a version: `git fetch --tags --force`.","If building from a tarball, clone the repo instead of using the archive.","Inspect the stderr printed after the message to fix the underlying git failure (e.g. safe.directory, ownership, missing git)."],"exampleFix":"// before (CI shallow checkout)\n- uses: actions/checkout@v4\n  with: { fetch-depth: 1 }\n// after\n- uses: actions/checkout@v4\n  with: { fetch-depth: 0 }\n- run: git fetch --tags --force","handlingStrategy":"validation","validationCode":"# Ensure vdev prerequisites before release commands\ngit rev-parse --is-inside-work-tree || { echo \"not a git repo\"; exit 1; }\ngit fetch --tags --force\ngit describe --tags >/dev/null || { echo \"git describe failed\"; exit 1; }","typeGuard":null,"tryCatchPattern":"// Wrap vdev release invocations and surface stderr\nif ! cargo vdev <release-cmd>; then\n  echo \"vdev failed; check git repo state and tags\" >&2\n  exit 1\nfi","preventionTips":["Always run vdev from a full git clone with tags fetched (fetch-depth: 0).","Verify `git describe` works before running release automation.","Avoid building releases from tarballs or archive exports without .git.","Keep git installed and repo permissions (safe.directory) correct in CI images."],"tags":["git","cli","versioning","release"],"backgroundTag":"git-command-failed","analyzedSha":"bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013","analyzedAt":"2026-09-16T02:53:35.741Z","contentChangedAt":"2026-09-16T02:53:35.741Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}