{"id":"0a896bf0fae96852","repo":"rust-lang/cargo","slug":"found-build-scripts-with-duplicate-file-stems-but","errorCode":null,"errorMessage":"found build scripts with duplicate file stems, but all build scripts must have a unique file stem","messagePattern":"found build scripts with duplicate file stems, but all build scripts must have a unique file stem","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/workspace/parser/targets.rs","lineNumber":928,"sourceCode":"            .file_stem()\n            .and_then(|s| s.to_str())\n            .expect(\"previously normalized\");\n        seen.entry(stem)\n            .or_insert_with(Vec::new)\n            .push(script.as_str());\n    }\n    let mut conflict_file_stem = false;\n    let mut err_msg = String::from(\n        \"found build scripts with duplicate file stems, but all build scripts must have a unique file stem\",\n    );\n    for (stem, paths) in seen {\n        if paths.len() > 1 {\n            conflict_file_stem = true;\n            write!(&mut err_msg, \"\\n  for stem `{stem}`: {}\", paths.join(\", \"))?;\n        }\n    }\n    if conflict_file_stem {\n        anyhow::bail!(err_msg);\n    }\n    Ok(())\n}\n\nfn configure(\n    toml: &TomlTarget,\n    target: &mut Target,\n    target_kind_human: &str,\n    warnings: &mut Vec<String>,\n) -> CargoResult<()> {\n    let t2 = target.clone();\n    target\n        .set_tested(toml.test.unwrap_or_else(|| t2.tested()))\n        .set_doc(toml.doc.unwrap_or_else(|| t2.documented()))\n        .set_doctest(toml.doctest.unwrap_or_else(|| t2.doctested()))\n        .set_benched(toml.bench.unwrap_or_else(|| t2.benched()))\n        .set_harness(toml.harness.unwrap_or_else(|| t2.harness()))\n        .set_proc_macro(toml.proc_macro().unwrap_or_else(|| t2.proc_macro()))","sourceCodeStart":910,"sourceCodeEnd":946,"githubUrl":"https://github.com/rust-lang/cargo/blob/0e07a155371a6ce88ae53a2c00df940280c09a67/src/workspace/parser/targets.rs#L910-L946","documentation":"Error \"found build scripts with duplicate file stems, but all build scripts must have a unique file stem\" thrown in rust-lang/cargo.","triggerScenarios":"Thrown at src/workspace/parser/targets.rs:928 when the library encounters an invalid state.","commonSituations":"Occurs when multiple build scripts share the same file stem (e.g. `build.rs` and `build/main.rs` both stemming to `build`). Rename build script files so their stems are unique.","solutions":["Rename one of the build script files so their file stems are unique.","Point `build = \"...\"` at distinct script paths for each package."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"0e07a155371a6ce88ae53a2c00df940280c09a67","analyzedAt":"2026-08-06T01:46:58.334Z","schemaVersion":2}