openai/codex · error · anyhow::Error
network.mitm_hooks[ ].match.methods must not be empty
Error message
network.mitm_hooks[{hook_index}].match.methods must not be empty What it means
Validation error from validate_mitm_hook_config: a hook's match.methods list, after trim/uppercase normalization, is empty. The list was either declared as an empty array or contained only whitespace entries; a hook with no method constraints is considered a configuration mistake rather than a match-all.
Solutions
- List the HTTP methods the hook should match, e.g. ["GET","POST"]
- Remove the hook entirely if it should not apply
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at codex-rs/network-proxy/src/mitm_hook.rs:189 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of openai/codex@339751715c (2026-08-25).
Data as JSON: /api/errors/4fd0cb5dac9adef4.
Report an issue: GitHub.
Appendix: source
Thrown at codex-rs/network-proxy/src/mitm_hook.rs:189
pub(crate) fn validate_mitm_hook_config(config: &NetworkProxyConfig) -> Result<()> {
let hooks = &config.mitm_hooks;
if hooks.is_empty() {
return Ok(());
}
if !config.mitm {
return Err(anyhow!("network.mitm_hooks requires network.mitm = true"));
}
for (hook_index, hook) in hooks.iter().enumerate() {
let host = normalize_hook_host(&hook.host)
.with_context(|| format!("invalid network.mitm_hooks[{hook_index}].host"))?;
let methods = normalize_methods(&hook.matcher.methods)
.with_context(|| format!("invalid network.mitm_hooks[{hook_index}].match.methods"))?;
if methods.is_empty() {
return Err(anyhow!(
"network.mitm_hooks[{hook_index}].match.methods must not be empty"
));
}
let path_prefixes =
compile_path_matchers(&hook.matcher.path_prefixes).with_context(|| {
format!("invalid network.mitm_hooks[{hook_index}].match.path_prefixes")
})?;
if path_prefixes.is_empty() {
return Err(anyhow!(
"network.mitm_hooks[{hook_index}].match.path_prefixes must not be empty"
));
}
if let Some(body) = hook.matcher.body.as_ref() {
let _ = body;
return Err(anyhow!(
"network.mitm_hooks[{hook_index}].match.body is reserved for a future release and is not yet supported"View on GitHub (pinned to 339751715c)