hasura/graphql-engine · error · MapFieldNamesError

Field mapping {field_name} not found for object type {object

Error message

Field mapping {field_name} not found for object type {object_type_name}

What it means

MapFieldNamesError::FieldMappingNotFound indicates the object's type mapping exists, but the value contains a field for which no field mapping entry exists in the data connector's type mapping for that object type. The planner cannot translate the client-side field name to the connector's column/field name.

Source

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

    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 {
            Self::ExpectedAnArray { .. }
            | Self::ExpectedAnObject { .. }
            | Self::UnknownFieldsInObject { .. } => ErrorVisibility::User,
            Self::TypeMappingsNotFound { .. } | Self::FieldMappingNotFound { .. } => {

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Correct the field name to match the mapped field exactly (case-sensitive)
  2. Inspect the type mapping's field_mappings for the object and remove or rename the offending key
  3. Regenerate client types / reload metadata after the connector schema changes
  4. If the field should exist, add the missing field mapping to the source's schema

Example fix

// before
{ "where": { "emial": { "_eq": "a@b.c" } } }
// after
{ "where": { "email": { "_eq": "a@b.c" } } }
Defensive patterns

Strategy: validation

Validate before calling

let known: HashSet<_> = mapping.field_mappings.keys().collect();
for k in value.keys() { assert!(known.contains(k), "unknown field {k}"); }

Type guard

const hasFieldMapping = (m: FieldMappings, f: string): boolean => Object.prototype.hasOwnProperty.call(m, f);

Try / catch

Catch FieldMappingNotFound and return a precise 'unknown field X on type Y' message to the caller.

Prevention

When it happens

Trigger: Passing an argument object containing a field that is not present in the type_mapping's field_mappings for the object, e.g. {"emial": ...} (typo) or a field that exists in metadata but not in the connector schema.

Common situations: Typos in field names inside nested argument objects; schema drift after a column rename; computed/derived fields exposed in metadata that lack backing mappings; stale client models after backend schema changes.

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