{"record":{"id":"7409dea76a01e32a","repo":"facebook/relay","slug":"should-return-the-deduplicated-raw-response-type","errorCode":null,"errorMessage":"should return the deduplicated raw response type","messagePattern":"should return the deduplicated raw response type","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"compiler/crates/relay-typegen/src/write.rs","lineNumber":419,"sourceCode":"            .map(|(_, type_)| type_)\n            .chain(std::iter::once(&raw_response_type))\n            .collect_vec();\n        let deduplicated = deduplicate_raw_response_types(&raw_response_types, operation_name.0);\n        let mut deduplicated_types = deduplicated.types.into_iter();\n        let match_fields = MatchFields(\n            match_fields\n                .into_iter()\n                .map(|(name, _)| {\n                    let type_ = deduplicated_types\n                        .next()\n                        .expect(\"should return one deduplicated type per match field\");\n                    (name, type_)\n                })\n                .collect(),\n        );\n        let raw_response_type = deduplicated_types\n            .next()\n            .expect(\"should return the deduplicated raw response type\");\n        debug_assert!(deduplicated_types.next().is_none());\n\n        (\n            DeduplicatedType {\n                type_: raw_response_type,\n                aliases: deduplicated.aliases,\n            },\n            match_fields,\n        )\n    } else {\n        (\n            DeduplicatedType {\n                type_: raw_response_type,\n                aliases: Vec::new(),\n            },\n            match_fields,\n        )\n    }","sourceCodeStart":401,"sourceCodeEnd":437,"githubUrl":"https://github.com/facebook/relay/blob/668b1b85e06261aa3b58dabfc51f8b5524a70955/compiler/crates/relay-typegen/src/write.rs#L401-L437","documentation":"Invariant in maybe_deduplicate_raw_response_types: the final raw response type itself must be present in deduplicate_raw_response_types' output after the per-match-field types are consumed. Firing means the dedup result omitted the root raw response type, indicating an off-by-one or misaligned output ordering in the dedup pass.","triggerScenarios":"Thrown at compiler/crates/relay-typegen/src/write.rs:419 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify deduplicate_raw_response_types returns match-field types first then the root raw response type in order","Audit the dedup output construction for dropped entries","Write a regression test with multiple match fields plus a root type"],"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"}