hasura/graphql-engine · error · ModelsIssue

An issue occurred while mapping arguments in the model {mode

Error message

An issue occurred while mapping arguments in the model {model_name:} to the collection {collection_name:} in the data connector {data_connector_name:}: {issue:}

What it means

While resolving a model whose source is a data connector command/collection, one of the model argument mappings could not be translated to the connector's representation. The underlying ArgumentMappingIssue is included in the message.

Source

Thrown at v3/crates/metadata-resolve/src/stages/models/types.rs:99

}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub enum ModelOrderBy {
    ModelV1 {
        graphql_type_name: Option<GraphQlTypeName>,
        orderable_fields: Vec<OrderableField>,
    },
    ModelV2(Option<open_dds::order_by_expression::OrderByExpressionName>),
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
pub struct NDCFieldSourceMapping {
    pub ndc_mapping: BTreeMap<FieldName, NdcColumnForComparison>,
}

#[derive(Debug, thiserror::Error)]
pub enum ModelsIssue {
    #[error(
        "An issue occurred while mapping arguments in the model {model_name:} to the collection {collection_name:} in the data connector {data_connector_name:}: {issue:}"
    )]
    FunctionArgumentMappingIssue {
        data_connector_name: Qualified<DataConnectorName>,
        model_name: Qualified<ModelName>,
        collection_name: CollectionName,
        issue: ArgumentMappingIssue,
    },
    #[error(
        "The orderable field '{field_name}' in model '{model_name}' is not a scalar field (type: {field_type}) and therefore cannot be used for ordering. Upgrade to version 2 Models and use OrderByExpressions to order by nested fields"
    )]
    ModelV1OrderableFieldIsNotAScalarField {
        model_name: Qualified<ModelName>,
        field_name: FieldName,
        field_type: QualifiedTypeReference,
    },
    #[error(
        "The orderable field '{field_name}' in model '{model_name}' is an array type (type: {field_type}) and therefore cannot be used for ordering"

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Inspect the appended ArgumentMappingIssue detail and fix that specific mapping
  2. Ensure the argument's type matches the target collection column type
  3. Remove or remap arguments that reference non-existent collection fields
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-check that each model argument maps to an existing, type-compatible collection field
for (arg, mapping) in &model.argument_mappings {
    let col = collection.columns.iter().find(|c| c.name == mapping.target)
        .unwrap_or_else(|| panic!("argument {arg} maps to unknown column"));
    assert!(types_compatible(&arg.type_, &col.type_));
}

Try / catch

catch (e) { if (e.message.includes('mapping arguments')) reportArgumentIssue(e); }

Prevention

When it happens

Trigger: A model with arguments (model v2 / command) where an argument type or mapping has no equivalent column/type in the target collection, e.g. an object-typed argument mapped against a scalar column.

Common situations: Defining model commands with argument mappings that don't line up with the underlying collection fields; renaming collection columns without updating argument mappings.

Related errors


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