{"record":{"id":"2a28cfe727698a1e","repo":"facebook/relay","slug":"unexpected-relayresolver","errorCode":null,"errorMessage":"Unexpected RelayResolver","messagePattern":"Unexpected RelayResolver","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"compiler/crates/relay-codegen/src/printer.rs","lineNumber":937,"sourceCode":"                        f.pop();\n                    }\n                    f.push('}');\n                    Ok(())\n                }\n            }\n        }\n        Primitive::Null | Primitive::SkippableNull => {\n            f.push_str(\"null\");\n            Ok(())\n        }\n        Primitive::StorageKey(_, _) => panic!(\"Unexpected StorageKey\"),\n        Primitive::RawString(_) => panic!(\"Unexpected RawString\"),\n        Primitive::GraphQLModuleDependency(_) => panic!(\"Unexpected GraphQLModuleDependency\"),\n        Primitive::JSModuleDependency { .. } => panic!(\"Unexpected JSModuleDependency\"),\n        Primitive::ResolverModuleReference { .. } => panic!(\"Unexpected ResolverModuleReference\"),\n        Primitive::PropertyAccessor(_) => panic!(\"Unexpected PropertyAccessor\"),\n        Primitive::DynamicImport { .. } => panic!(\"Unexpected DynamicImport\"),\n        Primitive::RelayResolverModel { .. } => panic!(\"Unexpected RelayResolver\"),\n    }\n}\n","sourceCodeStart":919,"sourceCodeEnd":940,"githubUrl":"https://github.com/facebook/relay/blob/668b1b85e06261aa3b58dabfc51f8b5524a70955/compiler/crates/relay-codegen/src/printer.rs#L919-L940","documentation":"Internal invariant panic in write_constant_value: a Primitive::RelayResolverModel (a resolver reference) was passed where only printable constant primitives are allowed. Resolver references must be handled by dedicated printer paths, not constant printing.","triggerScenarios":"write_argument_value or write_constant_value receives Primitive::RelayResolverModel — a Relay resolver model value reaching the constant/argument printing branch.","commonSituations":"A resolver whose return/argument type is another resolver, or a mis-wired resolver schema, causing the codegen printer to treat the resolver reference as a literal.","solutions":["Ensure resolvers are referenced only from fields/exports, not as literal constant values","Check resolver @exportable/@RelayResolver usage so model references are routed through export paths","File a Relay compiler bug with a minimal repro — this branch should be unreachable in valid schemas"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Resolve RelayResolverModel references to their export/field value before printing\nlet resolved = match primitive {\n    Primitive::RelayResolverModel { .. } => resolve_resolver_reference(primitive)?,\n    other => other,\n};\nwrite_constant_value(&resolved);","typeGuard":"fn is_literal_primitive(p: &Primitive) -> bool {\n    !matches!(p, Primitive::RelayResolverModel { .. })\n}","tryCatchPattern":"// pre-validate; a panic here is a compiler bug, capture with a repro and report upstream","preventionTips":["Keep resolver references out of constant/argument positions in the schema","Resolve model references before the print phase","Cover the printer with tests for every Primitive variant"],"tags":["compiler","rust","panic","codegen","internal-invariant"],"backgroundTag":"compiler-internal-invariant-panic","analyzedSha":"668b1b85e06261aa3b58dabfc51f8b5524a70955","analyzedAt":"2026-09-02T19:57:20.783Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}