vectordotdev/vector · error

Could not find the commit that added

Error message

Could not find the commit that added {relative_path}; cannot determine its pull requests.

What it means

When resolving the PRs that introduced a changelog fragment, `lookup_pull_requests_from_git` uses `git log --diff-filter=A` to find the commit that added the file. If git returns no such commit and PR metadata is required, the tool cannot attribute the fragment and fails.

Solutions

  1. Commit the changelog fragment (`git add changelog.d/... && git commit`) before running release generation.
  2. Ensure you run from the main repository, not a copy with truncated or rewritten history.
  3. If PR metadata is genuinely unavailable, check whether a flag or mode makes PR metadata optional in the tooling.

Example fix

// before
vdev release generate-cue 0.46.0   # fragment only staged, not committed
// after
git add changelog.d/my-change.bug.md && git commit -m "Add changelog fragment"
vdev release generate-cue 0.46.0
Defensive patterns

Strategy: validation

Validate before calling

git status --porcelain changelog.d/ | grep -q . && echo 'commit fragments before generating release'

Prevention

When it happens

Trigger: A fragment file exists in the working tree but was never committed; the file was added in a commit outside the repository's history (history rewrite, new repo); `git log --follow --diff-filter=A` returns empty for the relative path.

Common situations: Running release generation with uncommitted `changelog.d/` fragments; working in a fresh clone of a repo converted from another VCS; a squash/rebase removed the original adding commit from history.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


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

Appendix: source

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

        )
    })?;

    let addition_commits = run_command(
        "git",
        &[
            "log",
            "--format=%H",
            "--diff-filter=A",
            "--follow",
            "--",
            relative_path,
        ],
        repo_root,
    )?;
    let Some(latest_addition) = addition_commits.lines().next() else {
        return match pull_request_metadata {
            PullRequestMetadata::Optional => Ok(Vec::new()),
            PullRequestMetadata::Required => bail!(
                "Could not find the commit that added {relative_path}; cannot determine its pull requests."
            ),
        };
    };

    let commit_history = run_command(
        "git",
        &[
            "log",
            "--format=%H%x09%s",
            "--diff-filter=AMR",
            "--follow",
            "--",
            relative_path,
        ],
        repo_root,
    )?;

View on GitHub (pinned to 0d4ab78a4f)