vectordotdev/vector · error

Could not find version

Error message

Could not find version {} to update in {}

What it means

The version bump replaces the old major.minor version string with the new one. If the file's contents do not contain the current latest major.minor string at all, the tool refuses to proceed rather than writing a partially-updated file, since it cannot verify the expected old version is present.

Solutions

  1. Check the file: if it already contains the new version, the bump is done — skip/re-run the release step accordingly (`git diff <file>`).
  2. Restore the file to the pre-release state (`git checkout -- <file>`) and re-run prepare from a clean tree.
  3. Update the file so it contains the old `MAJOR.MINOR` string where expected, matching the format the tool searches for.

Example fix

// before
version = "0.50.0"   # already bumped, old 0.49 absent
// after
git checkout -- Cargo.toml && vdev release prepare   # clean re-run
Defensive patterns

Strategy: validation

Validate before calling

let latest = "0.49";
let contents = std::fs::read_to_string("Cargo.toml")?;
if !contents.contains(latest) {
    panic!("old version {latest} not found — was the file already bumped?");
}

Prevention

When it happens

Trigger: update_vector_version reads a version file whose text lacks the `{major}.{minor}` of latest_vector_version — e.g. the file was already bumped, never contained the pattern, or was reformatted.

Common situations: Re-running `vdev release prepare` after a partial/previous bump (version already new); upstream file restructure removed the version string; the file uses a version format like '0.XX.0' that was changed upstream.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of vectordotdev/vector@bdb87aeaa4 (2026-09-16). Data as JSON: /api/errors/2946a5eca300f04b. Report an issue: GitHub.

Appendix: source

Thrown at vdev/src/commands/release/prepare.rs:185

        self.append_vrl_changelog_to_release_cue()?;
        debug!("Generated release CUE file");
        Ok(())
    }

    /// Steps 5 & 6: Replace old version with the new version.
    fn update_vector_version(&self, file_path: &Path) -> Result<()> {
        debug!("update_vector_version for {file_path:?}");
        let contents = fs::read_to_string(file_path)
            .map_err(|e| anyhow!("Failed to read {}: {}", file_path.display(), e))?;

        let latest_version = &self.latest_vector_version;
        let new_version = &self.new_vector_version;
        let old_version_str = format!("{}.{}", latest_version.major, latest_version.minor);
        let new_version_str = format!("{}.{}", new_version.major, new_version.minor);

        if !contents.contains(&old_version_str) {
            return Err(anyhow!(
                "Could not find version {} to update in {}",
                latest_version,
                file_path.display()
            ));
        }

        let updated_contents =
            contents.replace(&latest_version.to_string(), &new_version.to_string());
        let updated_contents = updated_contents.replace(&old_version_str, &new_version_str);

        fs::write(file_path, updated_contents)
            .map_err(|e| anyhow!("Failed to write {}: {}", file_path.display(), e))?;

        Ok(())
    }

    /// Final step. Create a release prep PR against the release branch.
    fn open_release_pr(&self) -> Result<()> {

View on GitHub (pinned to bdb87aeaa4)