{"record":{"id":"0bb270386ab6ec79","repo":"openai/codex","slug":"duplicate-agent-role-name-role-name-declared-i-0bb270","errorCode":null,"errorMessage":"duplicate agent role name `{role_name}` declared in config","messagePattern":"duplicate agent role name `(.+?)` declared in config","errorType":"validation","errorClass":"std::io::Error","httpStatus":null,"severity":"error","filePath":"codex-rs/core/src/config/agent_roles.rs","lineNumber":133,"sourceCode":"\nfn push_agent_role_warning(startup_warnings: &mut Vec<String>, err: std::io::Error) {\n    let message = format!(\"Ignoring malformed agent role definition: {err}\");\n    tracing::warn!(\"{message}\");\n    startup_warnings.push(message);\n}\n\nasync fn load_agent_roles_without_layers(\n    fs: &dyn ExecutorFileSystem,\n    cfg: &ConfigToml,\n) -> std::io::Result<BTreeMap<String, AgentRoleConfig>> {\n    let mut roles = BTreeMap::new();\n    if let Some(agents_toml) = cfg.agents.as_ref() {\n        for (declared_role_name, role_toml) in &agents_toml.roles {\n            let (role_name, role) = read_declared_role(fs, declared_role_name, role_toml).await?;\n            validate_required_agent_role_description(&role_name, role.description.as_deref())?;\n\n            if roles.insert(role_name.clone(), role).is_some() {\n                return Err(std::io::Error::new(\n                    std::io::ErrorKind::InvalidInput,\n                    format!(\"duplicate agent role name `{role_name}` declared in config\"),\n                ));\n            }\n        }\n    }\n\n    Ok(roles)\n}\n\nasync fn read_declared_role(\n    fs: &dyn ExecutorFileSystem,\n    declared_role_name: &str,\n    role_toml: &AgentRoleToml,\n) -> std::io::Result<(String, AgentRoleConfig)> {\n    let mut role = agent_role_config_from_toml(fs, declared_role_name, role_toml).await?;\n    let mut role_name = declared_role_name.to_string();\n    if let Some(config_file) = role.config_file.as_deref() {","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/core/src/config/agent_roles.rs#L115-L151","documentation":"Error \"duplicate agent role name `{role_name}` declared in config\" thrown in openai/codex.","triggerScenarios":"Thrown at codex-rs/core/src/config/agent_roles.rs:133 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Rename or remove one of the duplicated agent roles across the config layers."],"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"}