openai/codex · error · anyhow::Error
network policy amendment host
Error message
network policy amendment host '{}' does not match approved host '{}' What it means
Guard in validated_network_policy_amendment_host: the normalized host in the NetworkPolicyAmendment differs from the normalized host in the NetworkApprovalContext, i.e. the amendment targets a host the user never approved. Indicates an internal inconsistency, not user error.
Solutions
- Request approval for the correct host, or fix the amendment to use the approved host.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at codex-rs/core/src/session/mod.rs:2340 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/bc4b8ac158d209dd.
Report an issue: GitHub.
Appendix: source
Thrown at codex-rs/core/src/session/mod.rs:2340
anyhow::anyhow!("failed to persist network policy amendment to execpolicy: {err}")
})?;
// Without a running proxy, persistence is the first effective policy change.
if let Some(on_policy_applied) = on_policy_applied {
on_policy_applied();
}
Ok(())
}
fn validated_network_policy_amendment_host(
amendment: &NetworkPolicyAmendment,
network_approval_context: &NetworkApprovalContext,
) -> anyhow::Result<String> {
let approved_host = normalize_host(&network_approval_context.host);
let amendment_host = normalize_host(&amendment.host);
if amendment_host != approved_host {
return Err(anyhow::anyhow!(
"network policy amendment host '{}' does not match approved host '{}'",
amendment.host,
network_approval_context.host
));
}
Ok(approved_host)
}
pub(crate) async fn record_network_policy_amendment_message(
&self,
sub_id: &str,
amendment: &NetworkPolicyAmendment,
) {
let message: ResponseItem = ContextualUserFragment::into(NetworkRuleSaved::new(amendment));
let turn_context = self.turn_context_for_sub_id(sub_id).await;
self.inject_no_new_turn(vec![message], turn_context.as_deref())
.await;
}View on GitHub (pinned to 339751715c)