hasura/graphql-engine · error · MapFieldNamesError

Type mappings not found for object type {object_type_name}

Error message

Type mappings not found for object type {object_type_name}

What it means

MapFieldNamesError::TypeMappingsNotFound means the planner found a value typed as a given object type (Qualified<CustomTypeName>) but the underlying data connector's schema has no type mapping registered for that type name. Field-name mapping cannot proceed because there is no mapping table for the object at all.

Source

Thrown at v3/crates/plan/src/query/arguments.rs:653

            },
        };
        resolved_arguments.insert(argument_name, resolved_argument_value.clone());
    }

    Ok(resolved_arguments)
}

#[derive(Debug, thiserror::Error)]
pub enum MapFieldNamesError {
    #[error("Value did not match array type, was expecting {expected_type}")]
    ExpectedAnArray {
        expected_type: QualifiedTypeReference,
    },
    #[error("Value did not match object type, was expecting {expected_type}")]
    ExpectedAnObject {
        expected_type: QualifiedTypeReference,
    },
    #[error("Type mappings not found for object type {object_type_name}")]
    TypeMappingsNotFound {
        object_type_name: Qualified<CustomTypeName>,
    },
    #[error("Field mapping {field_name} not found for object type {object_type_name}")]
    FieldMappingNotFound {
        object_type_name: Qualified<CustomTypeName>,
        field_name: FieldName,
    },
    #[error("Unknown fields found in object type {object_type_name}: {fields:?}")]
    UnknownFieldsInObject {
        object_type_name: Qualified<CustomTypeName>,
        fields: Vec<String>,
    },
}

impl TraceableError for MapFieldNamesError {
    fn visibility(&self) -> ErrorVisibility {
        match self {

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Verify the object type name exists in the data source's type_mappings (check /capabilities or the connector schema)
  2. Reload/track the source so metadata type mappings are refreshed
  3. Fix the metadata or codegen so the type name exactly matches the connector's schema
  4. If the type lives in another source, reference that source instead

Example fix

// before
{ "type_mappings": { "User": {...} } }  // argument uses type "Users"
// after
{ "type_mappings": { "User": {...}, "Users": {...} } }  // names aligned
Defensive patterns

Strategy: validation

Validate before calling

// Before planning, confirm the type is mapped
let type_names: HashSet<_> = schema.type_mappings.keys().collect();
assert!(type_names.contains(&object_type_name), "type {object_type_name} missing from type_mappings");

Type guard

fn has_type_mapping(schema: &Schema, name: &Qualified<CustomTypeName>) -> bool { schema.type_mappings.contains_key(name) }

Try / catch

Degrade gracefully: catch TypeMappingsNotFound and report a configuration error naming the object type and source.

Prevention

When it happens

Trigger: Using an object type in an argument whose CustomTypeName is not present in the data source's schema.type_mappings — e.g. an object type defined only in metadata but not in the referenced NDC source, or a typo'd/renamed type name.

Common situations: Renaming an object type in metadata without regenerating/reloading the connector schema; referencing a type from a different data source; a stale Hasura metadata snapshot after the connector schema changed; bugs in codegen producing type names that don't match the source.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28). Data as JSON: /api/errors/0169557950b70fdd. Report an issue: GitHub.