{"record":{"id":"1edead24effe4d6b","repo":"rust-lang/rust","slug":"duplicate-job-name-job-name-in-section-secti","errorCode":null,"errorMessage":"duplicate job name `{job_name}` in section `{section}`","messagePattern":"duplicate job name `(.+?)` in section `(.+?)`","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/ci/citool/src/jobs.rs","lineNumber":150,"sourceCode":"        // environment versus PR environment.\n        if db.find_auto_job_by_name(&pr_job.name).is_some() {\n            continue;\n        }\n\n        let auto_registered_job = Job { continue_on_error: Some(false), ..pr_job.clone() };\n        db.auto_jobs.push(auto_registered_job);\n    }\n\n    Ok(())\n}\n\nfn validate_job_database(db: &JobDatabase) -> anyhow::Result<()> {\n    fn ensure_no_duplicate_job_names(section: &str, jobs: &Vec<Job>) -> anyhow::Result<()> {\n        let mut job_names = HashSet::new();\n        for job in jobs {\n            let job_name = job.name.as_str();\n            if !job_names.insert(job_name) {\n                return Err(anyhow::anyhow!(\n                    \"duplicate job name `{job_name}` in section `{section}`\"\n                ));\n            }\n        }\n        Ok(())\n    }\n\n    ensure_no_duplicate_job_names(\"pr\", &db.pr_jobs)?;\n    ensure_no_duplicate_job_names(\"auto\", &db.auto_jobs)?;\n    ensure_no_duplicate_job_names(\"try\", &db.try_jobs)?;\n    ensure_no_duplicate_job_names(\"optional\", &db.optional_jobs)?;\n\n    fn equivalent_modulo_carve_out(pr_job: &Job, auto_job: &Job) -> anyhow::Result<()> {\n        let Job {\n            name,\n            os,\n            only_on_channel,\n            free_disk,","sourceCodeStart":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/rust-lang/rust/blob/7088e4b63a9516ebfbfe2ab2d999cf01a528ac14/src/ci/citool/src/jobs.rs#L132-L168","documentation":"citool builds a JobDatabase from the CI job YAML and runs validate_job_database (src/ci/citool/src/jobs.rs:144). ensure_no_duplicate_job_names rejects any job name that appears more than once within a single section — one of pr, auto, try, or optional. The duplicate name plus section name are reported.","triggerScenarios":"Editing rust-ci.yml or the job-definition files so that two jobs in the same section (pr_jobs/auto_jobs/try_jobs/optional_jobs) share an identical name key.","commonSituations":"Copy-pasting a job block and forgetting to rename it; merging two config files that both define a job; refactoring that moves a job between sections but leaves the old entry.","solutions":["Rename one of the colliding jobs so every name within a section is unique.","If the duplicate is intentional, move the second entry to a different section (e.g. optional-) or merge their configs.","Search the config for the reported name and remove the stale block.","Add a local pre-commit check that asserts uniqueness per section."],"exampleFix":"# before\npr_jobs:\n  - name: x86_64-gnu\n    ...\n  - name: x86_64-gnu   # duplicate -> error\n    ...\n\n# after\npr_jobs:\n  - name: x86_64-gnu\n    ...\n  - name: x86_64-gnu-debug\n    ...","handlingStrategy":"validation","validationCode":"use std::collections::HashSet;\nfn ensure_unique(section: &str, names: &[String]) -> Result<(), String> {\n    let mut seen = HashSet::new();\n    for n in names {\n        if !seen.insert(n.clone()) {\n            return Err(format!(\"duplicate job name `{n}` in section `{section}`\"));\n        }\n    }\n    Ok(())\n}\n// Run ensure_unique on each section before submitting the config.","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Lint job-config YAML for per-section name uniqueness in CI.","Rename rather than copy-paste job blocks.","Run citool validation locally before pushing."],"tags":["citool","ci","config","jobs","validation"],"backgroundTag":null,"analyzedSha":"7088e4b63a9516ebfbfe2ab2d999cf01a528ac14","analyzedAt":"2026-08-10T14:17:03.603Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}