{"record":{"id":"a513714f0d2d213c","repo":"openai/codex","slug":"failed-to-write-to-policy-file-path-source","errorCode":null,"errorMessage":"failed to write to policy file {path}: {source}","messagePattern":"failed to write to policy file (.+?): (.+?)","errorType":"exception","errorClass":"AmendError","httpStatus":null,"severity":"error","filePath":"codex-rs/execpolicy/src/amend.rs","lineNumber":36,"sourceCode":"    #[error(\"invalid network rule: {0}\")]\n    InvalidNetworkRule(String),\n    #[error(\"policy path has no parent: {path}\")]\n    MissingParent { path: PathBuf },\n    #[error(\"failed to create policy directory {dir}: {source}\")]\n    CreatePolicyDir {\n        dir: PathBuf,\n        source: std::io::Error,\n    },\n    #[error(\"failed to format prefix tokens: {source}\")]\n    SerializePrefix { source: serde_json::Error },\n    #[error(\"failed to serialize network rule field: {source}\")]\n    SerializeNetworkRule { source: serde_json::Error },\n    #[error(\"failed to open policy file {path}: {source}\")]\n    OpenPolicyFile {\n        path: PathBuf,\n        source: std::io::Error,\n    },\n    #[error(\"failed to write to policy file {path}: {source}\")]\n    WritePolicyFile {\n        path: PathBuf,\n        source: std::io::Error,\n    },\n    #[error(\"failed to lock policy file {path}: {source}\")]\n    LockPolicyFile {\n        path: PathBuf,\n        source: std::io::Error,\n    },\n    #[error(\"failed to seek policy file {path}: {source}\")]\n    SeekPolicyFile {\n        path: PathBuf,\n        source: std::io::Error,\n    },\n    #[error(\"failed to read policy file {path}: {source}\")]\n    ReadPolicyFile {\n        path: PathBuf,\n        source: std::io::Error,","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/execpolicy/src/amend.rs#L18-L54","documentation":"AmendError::WritePolicyFile: writing the amended policy content back to `path` failed mid-write. The io::Error source explains the failure; the file lock and file-descriptor handling unwind afterwards.","triggerScenarios":"Thrown at codex-rs/execpolicy/src/amend.rs:36 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the wrapped io::Error for the OS cause (ENOSPC, EIO)","Check available disk space on the volume holding the policy file","Retry the amendment; the file lock protects against partial concurrent updates"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}