{"record":{"id":"3474d059183e72ca","repo":"openai/codex","slug":"invalid-network-rule-0","errorCode":null,"errorMessage":"invalid network rule: {0}","messagePattern":"invalid network rule: (.+?)","errorType":"exception","errorClass":"AmendError","httpStatus":null,"severity":"error","filePath":"codex-rs/execpolicy/src/amend.rs","lineNumber":18,"sourceCode":"use std::fs::OpenOptions;\nuse std::io::Read;\nuse std::io::Seek;\nuse std::io::SeekFrom;\nuse std::io::Write;\nuse std::path::Path;\nuse std::path::PathBuf;\n\nuse crate::decision::Decision;\nuse crate::rule::NetworkRuleProtocol;\nuse crate::rule::normalize_network_rule_host;\nuse thiserror::Error;\n\n#[derive(Debug, Error)]\npub enum AmendError {\n    #[error(\"prefix rule requires at least one token\")]\n    EmptyPrefix,\n    #[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}\")]","sourceCodeStart":1,"sourceCodeEnd":36,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/execpolicy/src/amend.rs#L1-L36","documentation":"AmendError::InvalidNetworkRule: a network rule string supplied to the amender failed parsing/normalization (bad protocol, malformed host, etc.). The message string details the specific defect; nothing is written to the policy file.","triggerScenarios":"Thrown at codex-rs/execpolicy/src/amend.rs:18 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Normalize the host (strip scheme/port/wildcards) before submitting the rule","Use a supported protocol value (tcp/udp) for the rule","Validate rules against the execpolicy rule format before amending"],"exampleFix":null,"handlingStrategy":"validation","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"}