{"record":{"id":"52040107f25fe887","repo":"facebook/relay","slug":"fragment-key-not-found-in-ir","errorCode":null,"errorMessage":"Fragment {key:?} not found in IR.","messagePattern":"Fragment (.+?) not found in IR\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"compiler/crates/dependency-analyzer/src/ir.rs","lineNumber":267,"sourceCode":"    }\n}\n\n// From `key` of changed definition, recursively traverse up the dependency tree, and add all related nodes (ancestors\n// of changed definitions which are not from base definitions, and all of their descendants) into the `result`\nfn add_related_nodes(\n    visited: &mut ExecutableDefinitionNameSet,\n    result: &mut ExecutableDefinitionNameMap<ExecutableDefinition>,\n    dependency_graph: &ExecutableDefinitionNameMap<Node>,\n    base_definition_names: &ExecutableDefinitionNameSet,\n    key: ExecutableDefinitionName,\n) {\n    if !visited.insert(key) {\n        return;\n    }\n\n    let parents = match dependency_graph.get(&key) {\n        None => {\n            panic!(\"Fragment {key:?} not found in IR.\");\n        }\n        Some(node) => &node.parents,\n    };\n    if parents.is_empty() {\n        if !base_definition_names.contains(&key) {\n            add_descendants(result, dependency_graph, key);\n        }\n    } else {\n        for parent in parents {\n            add_related_nodes(\n                visited,\n                result,\n                dependency_graph,\n                base_definition_names,\n                *parent,\n            );\n        }\n    }","sourceCodeStart":249,"sourceCodeEnd":285,"githubUrl":"https://github.com/facebook/relay/blob/668b1b85e06261aa3b58dabfc51f8b5524a70955/compiler/crates/dependency-analyzer/src/ir.rs#L249-L285","documentation":"Panic in add_related_nodes: while walking the dependency graph upward from a changed definition, the requested key was not present in the graph map. This means the caller passed a definition name that the dependency-analyzer never indexed — typically a fragment/operation referenced (e.g. via a spread) but missing from the IR passed to the analyzer, indicating an inconsistency between the computed dependencies and the supplied Program.","triggerScenarios":"Thrown at compiler/crates/dependency-analyzer/src/ir.rs:267 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the fragment referenced by the changed definition exists in the project's GraphQL documents (no typo or missing file in --src)","Rebuild the dependency graph from the same Program/IR that produced the changed definition names","Check custom transforms don't remove definitions that others still spread into","Report a Relay compiler bug if it reproduces on unmodified code with repro steps"],"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"}