openai/codex · error · anyhow::Error
network.mitm_hooks[{hook_index}].match.body is reserved for
Error message
network.mitm_hooks[{hook_index}].match.body is reserved for a future release and is not yet supported What it means
The codex network proxy deserializes network.mitm_hooks[i].match.body (MitmHookBodyConfig accepts arbitrary TOML values), but body matching is not implemented in this release. validate_mitm_hook_config rejects any hook whose match table contains a body key, so the config parses successfully yet fails at proxy startup or test time with this reserved-for-future-release message.
Source
Thrown at codex-rs/network-proxy/src/mitm_hook.rs:206
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"
));
}
validate_query_constraints(&hook.matcher.query)
.with_context(|| format!("invalid network.mitm_hooks[{hook_index}].match.query"))?;
validate_header_constraints(&hook.matcher.headers)
.with_context(|| format!("invalid network.mitm_hooks[{hook_index}].match.headers"))?;
validate_strip_request_headers(&hook.actions.strip_request_headers).with_context(|| {
format!("invalid network.mitm_hooks[{hook_index}].actions.strip_request_headers")
})?;
validate_injected_headers(&hook.actions.inject_request_headers).with_context(|| {
format!("invalid network.mitm_hooks[{hook_index}].actions.inject_request_headers")
})?;
if host.is_empty() {
return Err(anyhow!(
"network.mitm_hooks[{hook_index}].host must not be empty"View on GitHub (pinned to 339751715c)
Solutions
- Delete the body key (and its table) from every hook's match section
- Express the matching you need with supported matchers: methods, path_prefixes (including pattern: globs), query, and headers
- If body matching is required, check the codex release notes for the version that enables it before re-adding the key
Example fix
# before — config.toml
[[network.mitm_hooks]]
host = "api.example.com"
[network.mitm_hooks.match]
methods = ["POST"]
path_prefixes = ["/v1/"]
body = {contains = "draft"}
# after
[[network.mitm_hooks]]
host = "api.example.com"
[network.mitm_hooks.match]
methods = ["POST"]
path_prefixes = ["/v1/"] Defensive patterns
Strategy: validation
Validate before calling
// Rust — reject before compiling hooks
for (i, hook) in config.mitm_hooks.iter().enumerate() {
if hook.matcher.body.is_some() {
return Err(anyhow!("network.mitm_hooks[{i}].match.body is unsupported in this release"));
}
} Type guard
fn hook_has_no_body(hook: &MitmHookConfig) -> bool {
hook.matcher.body.is_none()
} Try / catch
match compile_mitm_hooks(&config) {
Ok(_) => {}
Err(err) => eprintln!("{err:#}"), // chain shows 'network.mitm_hooks[0].match.body is reserved ...'
} Prevention
- Treat any field documented as reserved as absent — never ship it in config
- Validate hook configs in CI by running the validator against the parsed TOML
- Pin config examples to the codex version of the binary that reads them
When it happens
Trigger: Any [[network.mitm_hooks]] entry whose match table sets body to any value — body = {contains = "draft"} or even an empty body = {} table — when validate_mitm_hook_config runs, or when compile_mitm_hooks_with_resolvers runs since it calls that validator first.
Common situations: Copying hook config from newer docs, a future release's examples, or another team's setup into an older binary; writing config ahead of the API; upgrading/downgrading codex versions where the field exists in the schema but the matcher is still gated.
Related errors
- network.mitm_hooks[{hook_index}].host must not be empty
- expected exactly one of secret_env_var or secret_file
- path_prefixes must not contain empty entries
- glob pattern must not be empty
- invalid glob pattern {pattern:?}: {err}
AI-assisted analysis of openai/codex@339751715c (2026-08-25).
Data as JSON: /api/errors/fbc9167a88328a3d.
Report an issue: GitHub.