{"record":{"id":"4ea9d96477271599","repo":"openai/codex","slug":"additional-developer-instructions-from-exceed","errorCode":null,"errorMessage":"`additional_developer_instructions` from {} exceeds the model-context limit of {MAX_MANAGED_DEVELOPER_INSTRUCTIONS_TOKENS} estimated tokens ({estimated_tokens} including context markers)","messagePattern":"`additional_developer_instructions` from (.+?) exceeds the model-context limit of (.+?) estimated tokens \\((.+?) including context markers\\)","errorType":"validation","errorClass":"io::Error","httpStatus":null,"severity":"error","filePath":"codex-rs/core/src/context/world_state/managed_developer_instructions.rs","lineNumber":69,"sourceCode":"}\n\n/// Reject oversized policy rather than silently dropping part of its instructions.\npub(crate) fn validate_managed_developer_instructions(\n    requirement: Option<&Sourced<String>>,\n) -> io::Result<()> {\n    let Some(requirement) = requirement else {\n        return Ok(());\n    };\n    // Reserve the notice used when an existing conversation receives a new policy.\n    let overhead = ManagedDeveloperInstructions {\n        instructions: format!(\"{REPLACEMENT_NOTICE}\\n\\n\"),\n    }\n    .render()\n    .len();\n    let rendered_bytes = requirement.value.len().saturating_add(overhead);\n    if rendered_bytes > approx_bytes_for_tokens(MAX_MANAGED_DEVELOPER_INSTRUCTIONS_TOKENS) {\n        let estimated_tokens = approx_tokens_from_byte_count(rendered_bytes);\n        return Err(io::Error::new(\n            io::ErrorKind::InvalidInput,\n            format!(\n                \"`additional_developer_instructions` from {} exceeds the model-context limit of {MAX_MANAGED_DEVELOPER_INSTRUCTIONS_TOKENS} estimated tokens ({estimated_tokens} including context markers)\",\n                requirement.source,\n            ),\n        ));\n    }\n    Ok(())\n}\n\n/// The managed policy currently visible in retained model history.\n#[derive(Clone, Debug)]\npub(crate) struct ManagedDeveloperInstructionsState {\n    instructions: Option<ManagedDeveloperInstructions>,\n}\n\n#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]\npub(crate) struct ManagedDeveloperInstructionsSnapshot {","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/core/src/context/world_state/managed_developer_instructions.rs#L51-L87","documentation":"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.","triggerScenarios":"Thrown at codex-rs/core/src/context/world_state/managed_developer_instructions.rs:69 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Shorten `additional_developer_instructions` from the reported source to fit under the token limit."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","schemaVersion":2},"datasetVersion":"2026-08-25T06:17:31.827Z"}