hasura/graphql-engine · error · TypeMappingCollectionError

Missing mapping for field {field_name:} when mapping type {t

Error message

Missing mapping for field {field_name:} when mapping type {type_name:} to object {ndc_type_name:} of data connector {data_connector:}

What it means

A field declared on the custom type has no field mapping when mapping the type to the connector object. Every field of a mapped type must have a corresponding field mapping to the object's fields.

Source

Thrown at v3/crates/metadata-resolve/src/helpers/type_mappings.rs:35

#[derive(thiserror::Error, Debug)]
pub enum TypeMappingCollectionError {
    #[error(
        "No mapping defined for type {type_name:} to object {ndc_type_name:} of data connector {data_connector:}"
    )]
    MappingNotDefined {
        type_name: Qualified<CustomTypeName>,
        data_connector: Qualified<DataConnectorName>,
        ndc_type_name: DataConnectorObjectType,
    },
    #[error(
        "No support for using the same type {type_name:} against multiple data connector objects {ndc_type_1:} and {ndc_type_2:}"
    )]
    MappingToMultipleDataConnectorObjectType {
        type_name: Qualified<CustomTypeName>,
        ndc_type_1: DataConnectorObjectType,
        ndc_type_2: DataConnectorObjectType,
    },
    #[error(
        "Missing mapping for field {field_name:} when mapping type {type_name:} to object {ndc_type_name:} of data connector {data_connector:}"
    )]
    MissingFieldMapping {
        type_name: Qualified<CustomTypeName>,
        field_name: FieldName,
        data_connector: Qualified<DataConnectorName>,
        ndc_type_name: DataConnectorObjectType,
    },

    #[error("Cannot return a predicate type from a command")]
    PredicateAsResponseType,

    #[error("Internal Error: Unknown type {type_name:} when collecting type mappings")]
    InternalUnknownType {
        type_name: Qualified<CustomTypeName>,
    },
    #[error("ndc validation error: {0}")]
    NDCValidationError(#[from] NDCValidationError),

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Add the missing field mapping entry for the named field
  2. If the field should not be exposed, remove it from the type definition
  3. Ensure field names in mappings match the ObjectType declarations
Defensive patterns

Strategy: validation

Validate before calling

for f in type_def.fields {
    assert!(mapping.field_mappings.contains_key(&f.name));
}

Prevention

When it happens

Trigger: Adding a field to an ObjectType without adding its entry in the type's field mappings; renaming a mapped field on one side only.

Common situations: Incremental edits to type definitions; generation scripts emitting partial mappings; field renames.

Related errors


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