{"record":{"id":"9c676e40fc5fb3c7","repo":"facebook/relay","slug":"if-a-fragment-spread-contains-an-updatable-direc","errorCode":null,"errorMessage":"If a fragment spread contains an __updatable directive, the associated data should be present and have type TypeConditionInfo","messagePattern":"If a fragment spread contains an __updatable directive, the associated data should be present and have type TypeConditionInfo","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"compiler/crates/relay-typegen/src/visit.rs","lineNumber":2948,"sourceCode":"        bubbled_type.nullable_type().clone()\n    } else {\n        match schema_field_directives.named(RequiredMetadataDirective::directive_name()) {\n            Some(_) => bubbled_type.non_null(),\n            None => bubbled_type,\n        }\n    }\n}\n\nfn get_type_condition_info(fragment_spread: &FragmentSpread) -> Option<TypeConditionInfo> {\n    fragment_spread\n          .directives\n          .named(*ASSIGNABLE_DIRECTIVE_FOR_TYPEGEN)\n          .map(|directive| {\n              directive\n                  .data\n                  .as_ref()\n                  .and_then(|data| data.downcast_ref().copied())\n                  .expect(\"If a fragment spread contains an __updatable directive, the associated data should be present and have type TypeConditionInfo\")\n          })\n}\n\n/// Returns the type of the generated query. This is the type parameter that you would have\n/// Example:\n/// { response: MyQuery$data, variables: MyQuery$variables }\npub(crate) fn get_operation_type_export(\n    variables_identifier_key: StringKey,\n    response_identifier_key: StringKey,\n    raw_response_prop: Option<KeyValuePairProp>,\n) -> Result<ExactObject, std::fmt::Error> {\n    let mut operation_types = vec![\n        Prop::KeyValuePair(KeyValuePairProp {\n            key: *VARIABLES,\n            read_only: false,\n            optional: false,\n            value: AST::Identifier(variables_identifier_key),\n        }),","sourceCodeStart":2930,"sourceCodeEnd":2966,"githubUrl":"https://github.com/facebook/relay/blob/668b1b85e06261aa3b58dabfc51f8b5524a70955/compiler/crates/relay-typegen/src/visit.rs#L2930-L2966","documentation":"Invariant in get_type_condition_info: when a fragment spread carries the assignable-for-typegen directive, its data must downcast to TypeConditionInfo. Firing means the directive was attached without the expected typed payload (malformed or externally authored directive), so the type condition metadata is missing.","triggerScenarios":"Thrown at compiler/crates/relay-typegen/src/visit.rs:2948 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure only internal transforms attach the assignable directive, always with TypeConditionInfo data","Handle the None/failed-downcast case gracefully instead of unwrapping","Add a validation pass that rejects assignable directives lacking TypeConditionInfo data"],"exampleFix":null,"handlingStrategy":"type-guard","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"}