{"record":{"id":"1881028a71a59420","repo":"openai/codex","slug":"network-mitm-hooks-requires-network-mitm-true","errorCode":null,"errorMessage":"network.mitm_hooks requires network.mitm = true","messagePattern":"network\\.mitm_hooks requires network\\.mitm = true","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"codex-rs/network-proxy/src/mitm_hook.rs","lineNumber":179,"sourceCode":"}\n\npub type MitmHooksByHost = BTreeMap<String, Vec<MitmHook>>;\n\n#[derive(Debug, Clone, PartialEq, Eq)]\npub enum HookEvaluation {\n    NoHooksForHost,\n    Matched { actions: MitmHookActions },\n    HookedHostNoMatch,\n}\n\npub(crate) fn validate_mitm_hook_config(config: &NetworkProxyConfig) -> Result<()> {\n    let hooks = &config.mitm_hooks;\n    if hooks.is_empty() {\n        return Ok(());\n    }\n\n    if !config.mitm {\n        return Err(anyhow!(\"network.mitm_hooks requires network.mitm = true\"));\n    }\n\n    for (hook_index, hook) in hooks.iter().enumerate() {\n        let host = normalize_hook_host(&hook.host)\n            .with_context(|| format!(\"invalid network.mitm_hooks[{hook_index}].host\"))?;\n\n        let methods = normalize_methods(&hook.matcher.methods)\n            .with_context(|| format!(\"invalid network.mitm_hooks[{hook_index}].match.methods\"))?;\n        if methods.is_empty() {\n            return Err(anyhow!(\n                \"network.mitm_hooks[{hook_index}].match.methods must not be empty\"\n            ));\n        }\n\n        let path_prefixes =\n            compile_path_matchers(&hook.matcher.path_prefixes).with_context(|| {\n                format!(\"invalid network.mitm_hooks[{hook_index}].match.path_prefixes\")\n            })?;","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/network-proxy/src/mitm_hook.rs#L161-L197","documentation":"Error \"network.mitm_hooks requires network.mitm = true\" thrown in openai/codex.","triggerScenarios":"Thrown at codex-rs/network-proxy/src/mitm_hook.rs:179 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"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"}