{"record":{"id":"6680eb2b2ef600ad","repo":"openai/codex","slug":"invalid-requirement-for-mcp-server-server-name","errorCode":null,"errorMessage":"invalid requirement for MCP server `{server_name}` (set by {requirement_source}): {reason}","messagePattern":"invalid requirement for MCP server `(.+?)` \\(set by (.+?)\\): (.+?)","errorType":"validation","errorClass":"ConstraintError","httpStatus":null,"severity":"error","filePath":"codex-rs/config/src/constraint.rs","lineNumber":31,"sourceCode":"        field_name: &'static str,\n        candidate: String,\n        allowed: String,\n        requirement_source: RequirementSource,\n    },\n\n    #[error(\"To use model `{model}`, you need to use auto review.\")]\n    AutoReviewRequired { model: String },\n\n    #[error(\"field `{field_name}` cannot be empty\")]\n    EmptyField { field_name: String },\n\n    #[error(\"invalid rules in requirements (set by {requirement_source}): {reason}\")]\n    ExecPolicyParse {\n        requirement_source: RequirementSource,\n        reason: String,\n    },\n\n    #[error(\n        \"invalid requirement for MCP server `{server_name}` (set by {requirement_source}): {reason}\"\n    )]\n    McpServerRequirementParse {\n        server_name: String,\n        requirement_source: RequirementSource,\n        reason: String,\n    },\n}\n\nimpl ConstraintError {\n    pub fn empty_field(field_name: impl Into<String>) -> Self {\n        Self::EmptyField {\n            field_name: field_name.into(),\n        }\n    }\n}\n\npub type ConstraintResult<T> = Result<T, ConstraintError>;","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/config/src/constraint.rs#L13-L49","documentation":"ConstraintError::McpServerRequirementParse (codex-rs/config/src/constraint.rs:31) is returned when a per-server MCP requirement inside a requirements layer fails to parse. The error names the offending MCP server and the RequirementSource whose file carries it, plus the underlying reason, so the bad stanza can be located directly.","triggerScenarios":"A requirements TOML entry constraining an MCP server (under its mcp server requirements table) has an unknown key, wrong type, or malformed structure; parsing happens while the constraint system builds the constrained MCP server config.","commonSituations":"Typing an unrecognized key under an MCP server requirement; schema drift after upgrading codex; requirements synced between environments running different codex versions.","solutions":["Fix the stanza for the server named in server_name in the requirements file named by requirement_source","Use the reason text to identify the exact key or type at fault and align it with the current MCP requirement schema","Reload or redeploy the requirements after the fix"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Dry-parse the requirements file, including MCP server stanzas, before deploying\nlet _: RequirementsToml = toml::from_str(&requirements_str)\n    .map_err(|e| format!(\"requirements would fail to load: {e}\"))?;","typeGuard":null,"tryCatchPattern":"match build_constraints(...) {\n    Err(ConstraintError::McpServerRequirementParse { server_name, requirement_source, reason }) => {\n        eprintln!(\"bad requirement for MCP server {server_name} in {requirement_source}: {reason}\");\n    }\n    r => r?,\n}","preventionTips":["Validate MCP server requirement stanzas against the current schema in CI","Keep MCP requirement keys in sync with the codex version deployed in the fleet","Prefer generated requirement files over hand-edited ones"],"tags":["config","mcp","requirements","validation","toml","rust"],"backgroundTag":"invalid-config-syntax","analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","schemaVersion":2},"datasetVersion":"2026-08-25T06:17:31.827Z"}