{"record":{"id":"2946a5eca300f04b","repo":"vectordotdev/vector","slug":"could-not-find-version-to-update-in","errorCode":null,"errorMessage":"Could not find version {} to update in {}","messagePattern":"Could not find version (.+?) to update in (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"vdev/src/commands/release/prepare.rs","lineNumber":185,"sourceCode":"\n        self.append_vrl_changelog_to_release_cue()?;\n        debug!(\"Generated release CUE file\");\n        Ok(())\n    }\n\n    /// Steps 5 & 6: Replace old version with the new version.\n    fn update_vector_version(&self, file_path: &Path) -> Result<()> {\n        debug!(\"update_vector_version for {file_path:?}\");\n        let contents = fs::read_to_string(file_path)\n            .map_err(|e| anyhow!(\"Failed to read {}: {}\", file_path.display(), e))?;\n\n        let latest_version = &self.latest_vector_version;\n        let new_version = &self.new_vector_version;\n        let old_version_str = format!(\"{}.{}\", latest_version.major, latest_version.minor);\n        let new_version_str = format!(\"{}.{}\", new_version.major, new_version.minor);\n\n        if !contents.contains(&old_version_str) {\n            return Err(anyhow!(\n                \"Could not find version {} to update in {}\",\n                latest_version,\n                file_path.display()\n            ));\n        }\n\n        let updated_contents =\n            contents.replace(&latest_version.to_string(), &new_version.to_string());\n        let updated_contents = updated_contents.replace(&old_version_str, &new_version_str);\n\n        fs::write(file_path, updated_contents)\n            .map_err(|e| anyhow!(\"Failed to write {}: {}\", file_path.display(), e))?;\n\n        Ok(())\n    }\n\n    /// Final step. Create a release prep PR against the release branch.\n    fn open_release_pr(&self) -> Result<()> {","sourceCodeStart":167,"sourceCodeEnd":203,"githubUrl":"https://github.com/vectordotdev/vector/blob/bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013/vdev/src/commands/release/prepare.rs#L167-L203","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check the file: if it already contains the new version, the bump is done — skip/re-run the release step accordingly (`git diff <file>`).","Restore the file to the pre-release state (`git checkout -- <file>`) and re-run prepare from a clean tree.","Update the file so it contains the old `MAJOR.MINOR` string where expected, matching the format the tool searches for."],"exampleFix":"// before\nversion = \"0.50.0\"   # already bumped, old 0.49 absent\n// after\ngit checkout -- Cargo.toml && vdev release prepare   # clean re-run","handlingStrategy":"validation","validationCode":"let latest = \"0.49\";\nlet contents = std::fs::read_to_string(\"Cargo.toml\")?;\nif !contents.contains(latest) {\n    panic!(\"old version {latest} not found — was the file already bumped?\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always run release prepare from a clean tree at the expected base commit","Never run prepare twice without resetting the working tree in between","Grep for the old version string before invoking the release command"],"tags":["rust","release","versioning"],"backgroundTag":"resource-not-found","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"}