{"record":{"id":"78528b0f3adcf27d","repo":"openai/codex","slug":"managed-config-file-has-no-parent-directory","errorCode":null,"errorMessage":"Managed config file {} has no parent directory","messagePattern":"Managed config file (.+?) has no parent directory","errorType":"exception","errorClass":"io::Error","httpStatus":null,"severity":"error","filePath":"codex-rs/config/src/loader/local.rs","lineNumber":238,"sourceCode":"            },\n            base_dir: hooks_config_folder,\n            toml: TomlValue::Table(toml::map::Map::from_iter([(\n                \"hooks\".to_string(),\n                hooks.clone(),\n            )])),\n        });\n    }\n    Ok(())\n}\n\nfn append_legacy_config_layers(\n    output: &mut Vec<LocalTomlLayer<ConfigLayerSource>>,\n    loaded: layer_io::LoadedConfigLayers,\n    codex_home: &AbsolutePathBuf,\n) -> io::Result<()> {\n    if let Some(config) = loaded.managed_config {\n        let base_dir = config.file.parent().ok_or_else(|| {\n            io::Error::new(\n                io::ErrorKind::InvalidData,\n                format!(\n                    \"Managed config file {} has no parent directory\",\n                    config.file.as_path().display()\n                ),\n            )\n        })?;\n        output.push(LocalTomlLayer {\n            source: ConfigLayerSource::LegacyManagedConfigTomlFromFile { file: config.file },\n            base_dir,\n            toml: config.managed_config,\n        });\n    }\n    if let Some(config) = loaded.managed_config_from_mdm {\n        output.push(LocalTomlLayer {\n            source: ConfigLayerSource::LegacyManagedConfigTomlFromMdm,\n            base_dir: codex_home.clone(),\n            toml: config.managed_config,","sourceCodeStart":220,"sourceCodeEnd":256,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/config/src/loader/local.rs#L220-L256","documentation":"append_legacy_config_layers (codex-rs/config/src/loader/local.rs:231) folds the legacy managed-config file into the layer stack and needs its parent directory as the layer base_dir. If the managed config file path has no parent (a filesystem root or empty path), it returns ErrorKind::InvalidData. It is reached via load_local_config_layers_with_overrides whenever a legacy managed config was found.","triggerScenarios":"loaded.managed_config is Some but config.file is a filesystem root or empty string: an MDM/managed-config location override or deployment wrote the wrong path for the legacy managed config file.","commonSituations":"Enterprise deployment scripts or MDM profiles misconfigure the managed config location; container images symlinking the managed config path at a root; testing with hand-set managed config paths.","solutions":["Set the managed config location to a real file path inside a directory","Verify where the managed config path comes from (default system path versus override) and correct the deployment","Remove the stray managed-config entry so the loader skips the legacy layer entirely"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if let Some(managed) = &loaded.managed_config {\n    anyhow::ensure!(\n        managed.file.as_path().parent().is_some(),\n        \"managed config path has no parent: {}\",\n        managed.file.display()\n    );\n}","typeGuard":"fn has_parent_dir(p: &std::path::Path) -> bool {\n    p.parent().is_some()\n}","tryCatchPattern":"match load_local_config_layers_with_overrides(...).await {\n    Err(e) if e.kind() == io::ErrorKind::InvalidData\n        && e.to_string().contains(\"Managed config file\") =>\n    {\n        // correct the managed-config deployment path, then reload\n    }\n    r => r?,\n}","preventionTips":["Validate deployment-provided managed config paths in provisioning scripts","Never point managed-config settings at directories or filesystem roots","Smoke-test MDM payloads on one machine before fleet rollout"],"tags":["config","managed-config","enterprise","filesystem","path","rust"],"backgroundTag":"invalid-file-path","analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","schemaVersion":2},"datasetVersion":"2026-08-25T06:17:31.827Z"}