{"record":{"id":"9a13f6d66bf0092b","repo":"openai/codex","slug":"methods-must-not-contain-empty-entries","errorCode":null,"errorMessage":"methods must not contain empty entries","messagePattern":"methods must not contain empty entries","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"codex-rs/network-proxy/src/mitm_hook.rs","lineNumber":555,"sourceCode":"    let normalized = normalize_host(host);\n    if normalized.is_empty() {\n        return Err(anyhow!(\"host must not be empty\"));\n    }\n    if normalized.contains('*') {\n        return Err(anyhow!(\n            \"MITM hook hosts must be exact hosts and cannot contain wildcards\"\n        ));\n    }\n    Ok(normalized)\n}\n\nfn normalize_methods(methods: &[String]) -> Result<Vec<String>> {\n    methods\n        .iter()\n        .map(|method| {\n            let normalized = method.trim().to_ascii_uppercase();\n            if normalized.is_empty() {\n                return Err(anyhow!(\"methods must not contain empty entries\"));\n            }\n            Ok(normalized)\n        })\n        .collect()\n}\n\nfn validate_query_constraints(query: &BTreeMap<String, Vec<String>>) -> Result<()> {\n    for (name, values) in query {\n        let normalized = normalize_query_name(name)?;\n        if normalized.is_empty() {\n            return Err(anyhow!(\"query keys must not be empty\"));\n        }\n        if values.is_empty() {\n            return Err(anyhow!(\n                \"query key {name:?} must list at least one allowed value\"\n            ));\n        }\n        let _ = compile_value_matchers(values)","sourceCodeStart":537,"sourceCodeEnd":573,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/network-proxy/src/mitm_hook.rs#L537-L573","documentation":"normalize_methods trims and uppercases each entry of match.methods; an entry that becomes empty afterwards — \"\" or whitespace-only — is rejected with 'methods must not contain empty entries'. The list itself must also be non-empty, which is a separate check ('match.methods must not be empty').","triggerScenarios":"methods = [\"\"], or methods = [\"GET\", \"  \"] in a [[network.mitm_hooks]] entry; methods matching is case-insensitive ('get' normalizes to 'GET'), but blank entries fail.","commonSituations":"Lists built by string concatenation that emit an empty element; trailing commas parsed as empty entries; editing out one method but leaving its separator.","solutions":["Remove blank entries from methods","Write standard HTTP method names (\"GET\", \"POST\", ...); case is normalized automatically","If the list ends up empty, that is the separate 'must not be empty' error — keep at least one method"],"exampleFix":"# before\nmethods = [\"GET\", \"\"]\n\n# after\nmethods = [\"GET\", \"POST\"]","handlingStrategy":"validation","validationCode":"// Rust — no blank method entries\nfor (i, hook) in config.mitm_hooks.iter().enumerate() {\n    if hook.matcher.methods.iter().any(|m| m.trim().is_empty()) {\n        return Err(anyhow!(\"network.mitm_hooks[{i}].match.methods has an empty entry\"));\n    }\n}","typeGuard":"fn methods_have_no_blanks(hook: &MitmHookConfig) -> bool {\n    hook.matcher.methods.iter().all(|m| !m.trim().is_empty())\n}","tryCatchPattern":"match validate_mitm_hook_config(&config) {\n    Ok(()) => {}\n    Err(err) => eprintln!(\"{err:#}\"), // 'invalid network.mitm_hooks[i].match.methods: methods must not contain empty entries'\n}","preventionTips":["Write methods explicitly and drop blank strings from generated lists","Case does not matter ('get' is fine); emptiness does","Keep at least one method per hook — an empty list trips the separate must-not-be-empty check"],"tags":["network","mitm","codex","config-validation","http-methods"],"backgroundTag":"config-validation-failed","analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","schemaVersion":2},"datasetVersion":"2026-08-25T06:17:31.827Z"}