facebook/relay · error
User is an object
Error message
User is an object
What it means
Test assertion in preserves_source_locations: get_object_id on the User type must succeed, i.e. User must be an object type. Firing means User resolved to a non-object kind (interface/union/scalar) or the object id lookup failed in the in-memory schema build.
Source
Thrown at compiler/crates/schema-set/src/build_in_memory_schema.rs:751
extension_sdl: &str,
extension_source: SourceLocationKey,
) -> DiagnosticsResult<SchemaSet> {
SchemaSet::from_schema_documents_with_extensions(
&[parse_schema_document(base_sdl, base_source).unwrap()],
&[parse_schema_document(extension_sdl, extension_source).unwrap()],
)
}
#[test]
fn preserves_source_locations() {
let sdl = "type Query { me: User }\n\ntype User { id: ID name: String }";
let source = SourceLocationKey::standalone("user.graphql");
let schema = build_in_memory_schema(&schema_set_from(sdl, source)).unwrap();
// The `User` type's name points back at the original source file, not a
// generated location — this is the whole purpose of the direct build.
let user_type = schema.get_type("User".intern()).expect("User type exists");
let user = schema.object(user_type.get_object_id().expect("User is an object"));
assert_eq!(user.name.location.source_location(), source);
assert_ne!(user.name.location, Location::generated());
// Field locations are preserved too.
let id_field_id = schema
.named_field(user_type, "id".intern())
.expect("User.id exists");
let id_field = schema.field(id_field_id);
assert_eq!(id_field.name.location.source_location(), source);
assert_ne!(id_field.name.location, Location::generated());
// Sanity: the schema is structurally usable (root + resolved field type).
assert!(schema.query_type().is_some());
assert!(matches!(id_field.type_, schema::TypeReference::Named(_)));
}
#[test]
fn resolves_builtin_scalars_and_defaults() {View on GitHub (pinned to 668b1b85e0)
Solutions
- Verify the fixture defines User as an object type
- Check SchemaData object id resolution for the built schema
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at compiler/crates/schema-set/src/build_in_memory_schema.rs:751 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/8ac31df12815e177.
Report an issue: GitHub.