{"record":{"id":"bc6b25b5d38eb034","repo":"facebook/relay","slug":"duplicate-operation-definitions-named-first","errorCode":null,"errorMessage":"\nDuplicate operation definitions named {}: \nfirst one: {:?}\nsecond one: {:?}\n","messagePattern":"\nDuplicate operation definitions named (.+?): \nfirst one: (.+?)\nsecond one: (.+?)\n","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"compiler/crates/program-with-dependencies/src/program_with_dependencies.rs","lineNumber":122,"sourceCode":"        fragment_signatures.extend(scoped_definitions.iter().filter_map(|def| {\n            if let ExecutableDefinition::Fragment(fragment) = def {\n                Some((fragment.name.item.clone(), fragment.into()))\n            } else {\n                None\n            }\n        }));\n        let transformed_scoped_definitions =\n            add_signatures_to_spreads(&fragment_signatures, scoped_definitions);\n\n        let mut seen_operation_loc = HashMap::new();\n        let mut seen_fragments_loc = HashMap::new();\n        for definition in transformed_scoped_definitions {\n            match definition {\n                ExecutableDefinition::Operation(operation) => {\n                    let loc = operation.name.location;\n                    let name = operation.name.item;\n                    if let Some(another) = seen_operation_loc.insert(name, loc) {\n                        panic!(\n                            \"\\nDuplicate operation definitions named {}: \\nfirst one: {:?}\\nsecond one: {:?}\\n\",\n                            name, loc, another\n                        );\n                    }\n                    scoped_operations.push(Arc::new(operation)); // Keep the order the operations same as inputs.\n                }\n                ExecutableDefinition::Fragment(fragment) => {\n                    let loc = fragment.name.location;\n                    let name = fragment.name.item;\n                    let fragment_ref = Arc::new(fragment);\n                    if let Some(another) =\n                        seen_fragments_loc.insert(name, fragment_ref.name.location)\n                    {\n                        panic!(\n                            \"\\nDuplicate fragment definitions named {}: \\nfirst one: {:?}\\nsecond one: {:?}\\n\",\n                            name, loc, another\n                        );\n                    }","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/facebook/relay/blob/668b1b85e06261aa3b58dabfc51f8b5524a70955/compiler/crates/program-with-dependencies/src/program_with_dependencies.rs#L104-L140","documentation":"Panic while building a ProgramWithDependencies from scoped definitions: two operation definitions share the same name within the scoped set; both source locations are printed. Operations must be globally unique per project, and this check enforces that before dependency-scoped compilation proceeds.","triggerScenarios":"Thrown at compiler/crates/program-with-dependencies/src/program_with_dependencies.rs:122 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Rename the colliding operations or remove the duplicate file","Check project scoping config so the same operation isn't pulled into one compilation twice","Verify overlapping --src directories aren't double-collecting documents"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"668b1b85e06261aa3b58dabfc51f8b5524a70955","analyzedAt":"2026-09-02T19:57:20.783Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}