{"record":{"id":"308c7f09ccef789e","repo":"vectordotdev/vector","slug":"failed-to-write","errorCode":null,"errorMessage":"Failed to write {}: {}","messagePattern":"Failed to write (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"vdev/src/commands/release/prepare.rs","lineNumber":197,"sourceCode":"        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<()> {\n        debug!(\"open_release_pr\");\n        git::push()?;\n\n        let new_vector_version = &self.new_vector_version;\n        let pr_title = format!(\"chore(releasing): prepare v{new_vector_version} release\");\n        let pr_body = format!(\"This PR prepares the release for Vector v{new_vector_version}\");\n        let gh_status = Command::new(\"gh\")\n            .arg(\"pr\")\n            .arg(\"create\")\n            .arg(\"--draft\")\n            .arg(\"--base\")\n            .arg(self.release_branch.as_str())","sourceCodeStart":179,"sourceCodeEnd":215,"githubUrl":"https://github.com/vectordotdev/vector/blob/bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013/vdev/src/commands/release/prepare.rs#L179-L215","documentation":"After computing the new contents in memory, update_vector_version writes them back with fs::write. This error wraps any write failure — typically permission denied, read-only file/checkout, or disk full — and aborts the release preparation step for that file.","triggerScenarios":"Prepare::run reaches the write-back of a bumped version file while the file is read-only, owned by another user, the checkout is read-only, or the filesystem is full.","commonSituations":"CI checkouts mounted read-only; files made read-only by `chmod 444`; running vdev as a non-owner user; disk quota exceeded on the build machine.","solutions":["Make the file writable (`chmod u+w <file>`), or fix ownership (`sudo chown $(whoami) <file>`).","Ensure the repo checkout is writable (don't run against a read-only mount; re-clone if needed).","Free disk space / raise quota (`df -h`) and re-run `vdev release prepare`."],"exampleFix":"// before\n-r--r--r-- Cargo.toml   # read-only -> write fails\n// after\nchmod u+w Cargo.toml && vdev release prepare","handlingStrategy":"try-catch","validationCode":"let meta = std::fs::metadata(file_path)?;\nif meta.permissions().readonly() {\n    panic!(\"{file_path:?} is read-only; make it writable before release prepare\");\n}","typeGuard":null,"tryCatchPattern":"match std::fs::write(file_path, contents) {\n    Ok(_) => /* proceed */,\n    Err(e) => eprintln!(\"make file writable / free disk space: {e}\"),\n}","preventionTips":["Ensure the release checkout is on a writable filesystem","Check `df -h` and disk quota before long release runs","Avoid chmod-ing version files to read-only; run vdev as the checkout owner"],"tags":["rust","filesystem","release"],"backgroundTag":"file-write-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"}