hasura/graphql-engine · error · TypeMappingCollectionError

ndc validation error: {0}

Error message

ndc validation error: {0}

What it means

Wrapper error propagating an inner NDCValidationError out of the type-mapping collection stage via the #[from] conversion. It indicates one of the ndc_validation errors (e.g. missing types, capability problems) occurred while collecting type mappings.

Source

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

    },
    #[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),
}

// Special case handling for commands with response config; as they don't match
// the ndc type mapping exactly.
#[derive(Debug)]
pub(crate) struct SpecialCaseTypeMapping<'a> {
    pub(crate) response_config: &'a CommandsResponseConfig,
    pub(crate) ndc_object_type: &'a ndc_models::ObjectType,
}

pub(crate) fn collect_type_mapping_for_source(
    mapping_to_collect: &TypeMappingToCollect,
    data_connector_name: &Qualified<DataConnectorName>,
    object_types: &type_permissions::ObjectTypesWithPermissions,
    scalar_types: &BTreeMap<Qualified<CustomTypeName>, scalar_types::ScalarTypeRepresentation>,
    collected_mappings: &mut BTreeMap<Qualified<CustomTypeName>, object_types::TypeMapping>,
    special_case: Option<&SpecialCaseTypeMapping>,

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Inspect the wrapped inner error message to identify the actual NDC validation failure
  2. Fix the underlying cause per that error's guidance (missing type, capability, mapping)
  3. Re-run metadata resolution to confirm the fix
Defensive patterns

Strategy: try-catch

Try / catch

match err {
    TypeMappingCollectionError::NDCValidationError(inner) => match inner { /* handle specific variant */ _ => {} },
    _ => {},
}

Prevention

When it happens

Trigger: Any NDCValidationError raised inside the type mapping collection code path, such as NoSuchType or QueryCapabilityUnsupported triggered while resolving command response types.

Common situations: Any underlying metadata/connector inconsistency surfacing through the type-mappings stage.

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/397b3b990d50ff43. Report an issue: GitHub.