vectordotdev/vector · error

Could not find latest addition commit

Error message

Could not find latest addition commit {latest_addition} in the fragment history

What it means

After identifying the commit that added the fragment, `parse_pull_request_history` walks the commit history looking for that specific commit hash. If the hash never appears in the parsed history and PR metadata is required, the tool aborts with this message.

Solutions

  1. Verify the commit exists with `git show <latest_addition>`; if missing, the history was rewritten — regenerate the fragment by re-saving it in a new commit.
  2. Run from a branch whose history contains the original fragment-adding commit (e.g. main).
  3. If the fragment is old, consider re-adding it so it gains a fresh, reachable addition commit.

Example fix

// before: commit abc1234 lost after rebase
// after
git mv changelog.d/my-change.bug.md /tmp/ && git commit -m drop && git mv back && git commit -m "Re-add fragment"
vdev release generate-cue 0.46.0
Defensive patterns

Strategy: validation

Validate before calling

git cat-file -e <addition-commit-hash>^{commit} 2>/dev/null || echo 'addition commit not in history; history was rewritten'

Prevention

When it happens

Trigger: The addition commit hash (`latest_addition`) is not present in the output of the history command — e.g. the commit was rebased/rewritten after the file was added, or the history enumeration was truncated by the arguments passed to `git log`.

Common situations: History rewriting (rebase, filter-branch, force-push) between fragment addition and release; running on a fork with different history; unusual git log formatting arguments causing the commit line to be skipped by the parser.

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/6cce5b84b59a594f. Report an issue: GitHub.

Appendix: source

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

            .split_once('\t')
            .ok_or_else(|| anyhow!("Malformed git log entry `{line}`"))?;

        match parse_pull_request_number(title) {
            Ok(number) if !numbers.contains(&number) => numbers.push(number),
            Ok(_) => {}
            Err(_) if pull_request_metadata == PullRequestMetadata::Optional => {}
            Err(error) => return Err(error.context(format!("Commit {commit}: `{title}`"))),
        }

        if commit == latest_addition {
            return Ok(numbers);
        }
    }

    match pull_request_metadata {
        PullRequestMetadata::Optional => Ok(Vec::new()),
        PullRequestMetadata::Required => {
            bail!("Could not find latest addition commit {latest_addition} in the fragment history")
        }
    }
}

fn parse_pull_request_number(commit_title: &str) -> Result<u64> {
    let number = commit_title
        .trim()
        .strip_suffix(')')
        .and_then(|title| title.rsplit_once("(#"))
        .map(|(_, number)| number)
        .filter(|number| !number.is_empty() && number.bytes().all(|byte| byte.is_ascii_digit()))
        .ok_or_else(|| anyhow!("Commit title must end with `(#<PR number>)`"))?;

    number
        .parse()
        .with_context(|| format!("Invalid PR number in commit title `{commit_title}`"))
}

View on GitHub (pinned to 0d4ab78a4f)