openai/codex · error · io::Error
`additional_developer_instructions` from {} exceeds the mode
Error message
`additional_developer_instructions` from {} exceeds the model-context limit of {MAX_MANAGED_DEVELOPER_INSTRUCTIONS_TOKENS} estimated tokens ({estimated_tokens} including context markers) What it means
Error "`additional_developer_instructions` from {} exceeds the model-context limit of {MAX_MANAGED_DEVELOPER_INSTRUCTIONS_TOKENS} estimated tokens ({estimated_tokens} including context markers)" thrown in openai/codex.
Source
Thrown at codex-rs/core/src/context/world_state/managed_developer_instructions.rs:69
}
/// Reject oversized policy rather than silently dropping part of its instructions.
pub(crate) fn validate_managed_developer_instructions(
requirement: Option<&Sourced<String>>,
) -> io::Result<()> {
let Some(requirement) = requirement else {
return Ok(());
};
// Reserve the notice used when an existing conversation receives a new policy.
let overhead = ManagedDeveloperInstructions {
instructions: format!("{REPLACEMENT_NOTICE}\n\n"),
}
.render()
.len();
let rendered_bytes = requirement.value.len().saturating_add(overhead);
if rendered_bytes > approx_bytes_for_tokens(MAX_MANAGED_DEVELOPER_INSTRUCTIONS_TOKENS) {
let estimated_tokens = approx_tokens_from_byte_count(rendered_bytes);
return Err(io::Error::new(
io::ErrorKind::InvalidInput,
format!(
"`additional_developer_instructions` from {} exceeds the model-context limit of {MAX_MANAGED_DEVELOPER_INSTRUCTIONS_TOKENS} estimated tokens ({estimated_tokens} including context markers)",
requirement.source,
),
));
}
Ok(())
}
/// The managed policy currently visible in retained model history.
#[derive(Clone, Debug)]
pub(crate) struct ManagedDeveloperInstructionsState {
instructions: Option<ManagedDeveloperInstructions>,
}
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub(crate) struct ManagedDeveloperInstructionsSnapshot {View on GitHub (pinned to 339751715c)
Solutions
- Shorten `additional_developer_instructions` from the reported source to fit under the token limit.
When it happens
Trigger: Thrown at codex-rs/core/src/context/world_state/managed_developer_instructions.rs:69 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/4ea9d96477271599.
Report an issue: GitHub.