facebook/relay · error
If a fragment spread contains an __updatable directive, the
Error message
If a fragment spread contains an __updatable directive, the associated data should be present and have type TypeConditionInfo
What it means
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.
Source
Thrown at compiler/crates/relay-typegen/src/visit.rs:2948
bubbled_type.nullable_type().clone()
} else {
match schema_field_directives.named(RequiredMetadataDirective::directive_name()) {
Some(_) => bubbled_type.non_null(),
None => bubbled_type,
}
}
}
fn get_type_condition_info(fragment_spread: &FragmentSpread) -> Option<TypeConditionInfo> {
fragment_spread
.directives
.named(*ASSIGNABLE_DIRECTIVE_FOR_TYPEGEN)
.map(|directive| {
directive
.data
.as_ref()
.and_then(|data| data.downcast_ref().copied())
.expect("If a fragment spread contains an __updatable directive, the associated data should be present and have type TypeConditionInfo")
})
}
/// Returns the type of the generated query. This is the type parameter that you would have
/// Example:
/// { response: MyQuery$data, variables: MyQuery$variables }
pub(crate) fn get_operation_type_export(
variables_identifier_key: StringKey,
response_identifier_key: StringKey,
raw_response_prop: Option<KeyValuePairProp>,
) -> Result<ExactObject, std::fmt::Error> {
let mut operation_types = vec![
Prop::KeyValuePair(KeyValuePairProp {
key: *VARIABLES,
read_only: false,
optional: false,
value: AST::Identifier(variables_identifier_key),
}),View on GitHub (pinned to 668b1b85e0)
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
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at compiler/crates/relay-typegen/src/visit.rs:2948 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of facebook/relay@668b1b85e0 (2026-09-02).
Data as JSON: /api/errors/9c676e40fc5fb3c7.
Report an issue: GitHub.