{"record":{"id":"4d15fac680b45594","repo":"facebook/relay","slug":"duplicate-operation-definitions-named-name-fi","errorCode":null,"errorMessage":"\nDuplicate operation definitions named {name}: \nfirst one: {loc:?}\nsecond one: {another:?}\n","messagePattern":"\nDuplicate operation definitions named (.+?): \nfirst one: (.+?)\nsecond one: (.+?)\n","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"compiler/crates/graphql-ir/src/program.rs","lineNumber":52,"sourceCode":"            fragments: Default::default(),\n            operations: Default::default(),\n        }\n    }\n\n    pub fn from_definitions(\n        schema: Arc<SDLSchema>,\n        definitions: Vec<ExecutableDefinition>,\n    ) -> Self {\n        let mut operations = Vec::new();\n        let mut fragments = HashMap::default();\n        let mut seen_operation_loc = HashMap::new();\n        for definition in 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 {name}: \\nfirst one: {loc:?}\\nsecond one: {another:?}\\n\"\n                        );\n                    }\n                    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                    if let Some(another) = fragments.insert(name, Arc::new(fragment)) {\n                        panic!(\n                            \"\\nDuplicate fragment definitions named {}: \\nfirst one: {:?}\\nsecond one: {:?}\\n\",\n                            name, loc, &another.name.location\n                        );\n                    }\n                }\n            }\n        }\n        Self {","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/facebook/relay/blob/668b1b85e06261aa3b58dabfc51f8b5524a70955/compiler/crates/graphql-ir/src/program.rs#L34-L70","documentation":"Panic while constructing a Program::from_definitions: two operation definitions in the same compilation unit share the same name. The first occurrence's source location and the duplicate's location are printed. Operations must be uniquely named because generated artifacts and the operation map are keyed by operation name.","triggerScenarios":"Thrown at compiler/crates/graphql-ir/src/program.rs:52 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Rename one of the colliding operations so each name is unique","Delete or exclude the duplicated file from the compiler sources","If using multiple --src globs, make sure the same file isn't included twice"],"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"}