hasura/graphql-engine · error · ArgumentPresetExecutionError

type mapping not found for object {object_type_name}

Error message

type mapping not found for object {object_type_name}

What it means

TypeMappingNotFound is thrown when the planner cannot find a type mapping for the named object type (Qualified<CustomTypeName>). Type mappings tell the planner how a custom object type maps to the data connector's type system; their absence makes argument/type coercion impossible for that object.

Source

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

    #[error("Model source not found for model '{model_name}'")]
    ModelSourceNotFound { model_name: Qualified<ModelName> },
    #[error("Model permissions for model {model_name} not found for role {role}")]
    ModelArgumentPresetsNotFound {
        role: Role,
        model_name: Qualified<ModelName>,
    },
    #[error("command {command_name} does not have a source defined")]
    CommandSourceNotFound {
        command_name: Qualified<CommandName>,
    },
    #[error("command permissions for command {command_name} not found for role {role}")]
    CommandArgumentPresetsNotFound {
        command_name: Qualified<CommandName>,
        role: Role,
    },
    #[error("argument mapping not found for {argument_name}")]
    ArgumentMappingNotFound { argument_name: ArgumentName },
    #[error("type mapping not found for object {object_type_name}")]
    TypeMappingNotFound {
        object_type_name: Qualified<CustomTypeName>,
    },
    #[error(
        "no data connector field mapping found for field '{field_name}' of object type '{object_type_name}'"
    )]
    FieldMappingNotFound {
        object_type_name: Qualified<CustomTypeName>,
        field_name: FieldName,
    },
    #[error(
        "no field definition found for field '{field_name}' of object type '{object_type_name}'"
    )]
    FieldDefinitionNotFound {
        object_type_name: Qualified<CustomTypeName>,
        field_name: FieldName,
    },
    #[error(

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Add a type mapping for the named object type in the object types section of metadata
  2. Verify the type name and subgraph qualification match exactly
  3. Regenerate mappings if the connector schema changed
  4. Validate metadata before deploying

Example fix

// before
{"objectTypes":{"Address":{}}}
// after
{"objectTypes":{"Address":{"mapping":{"dataConnector":"pg","type":"address"}}}}
Defensive patterns

Strategy: validation

Validate before calling

fn type_mapping_exists(metadata: &Metadata, t: &Qualified<CustomTypeName>) -> bool {
    metadata.object_types.get(t).map(|o| o.mapping.is_some()).unwrap_or(false)
}

Type guard

fn is_type_mapping_not_found(e: &ArgumentPresetExecutionError) -> bool {
    matches!(e, ArgumentPresetExecutionError::TypeMappingNotFound { .. })
}

Try / catch

match result {
    Err(PlanError::Arguments(ArgumentPresetExecutionError::TypeMappingNotFound { object_type_name })) => {
        bad_request(format!("no type mapping for {object_type_name}"));
    }
    other => other,
}

Prevention

When it happens

Trigger: Planning a query or preset involving an object type (e.g. an argument of a custom object type or a nested selection) whose Qualified<CustomTypeName> has no entry in the type mappings section of metadata.

Common situations: Defining a new object type without adding its type mapping; renaming a type in the schema without updating mappings; connector upgrades that introduce type changes requiring new mappings.

Related errors


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