{"record":{"id":"8e4ffcf35f3b6321","repo":"openai/codex","slug":"invalid-shell-environment-policy-in-error","errorCode":null,"errorMessage":"invalid shell environment policy in {}: {error}","messagePattern":"invalid shell environment policy in (.+?): (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"codex-rs/config/src/state.rs","lineNumber":514,"sourceCode":"    /// Requirement sources are tracked separately and are not included here.\n    pub fn all_layers_low_to_high(&self) -> impl DoubleEndedIterator<Item = &ConfigLayerEntry> {\n        self.layers.iter()\n    }\n\n    /// Returns all config layers, including disabled layers, from highest\n    /// precedence to lowest.\n    ///\n    /// Requirement sources are tracked separately and are not included here.\n    pub fn all_layers_high_to_low(&self) -> impl DoubleEndedIterator<Item = &ConfigLayerEntry> {\n        self.all_layers_low_to_high().rev()\n    }\n}\n\n/// Validates before merging so mixed forms and malformed filter entries cannot be normalized away.\npub(crate) fn validate_enabled_config_layers(layers: &[ConfigLayerEntry]) -> std::io::Result<()> {\n    for layer in layers.iter().filter(|layer| !layer.is_disabled()) {\n        validate_shell_environment_policy_filter_config(&layer.config).map_err(|error| {\n            std::io::Error::new(\n                std::io::ErrorKind::InvalidData,\n                format!(\n                    \"invalid shell environment policy in {}: {error}\",\n                    format_config_layer_source(&layer.name, CONFIG_TOML_FILE)\n                ),\n            )\n        })?;\n    }\n    Ok(())\n}\n\n/// Ensures precedence ordering of config layers is correct.\nfn verify_layer_ordering(layers: &[ConfigLayerEntry]) -> std::io::Result<()> {\n    if !layers.iter().map(|layer| &layer.name).is_sorted() {\n        return Err(std::io::Error::new(\n            std::io::ErrorKind::InvalidData,\n            \"config layers are not in correct precedence order\",\n        ));","sourceCodeStart":496,"sourceCodeEnd":532,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/config/src/state.rs#L496-L532","documentation":"Error \"invalid shell environment policy in {}: {error}\" thrown in openai/codex.","triggerScenarios":"Thrown at codex-rs/config/src/state.rs:514 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the shell environment policy entries in the indicated file per the reported error."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","schemaVersion":2},"datasetVersion":"2026-08-25T06:17:31.827Z"}