hasura/graphql-engine · error · ModelsIssue

The order by expression '{order_by_expression_identifier}' u

Error message

The order by expression '{order_by_expression_identifier}' used in model '{model_name}' contains a nested field '{nested_field_name}', however the data connector '{data_connector_name}' used in the model does not support ordering by nested fields

What it means

An order_by expression in a v2 model traverses a nested field, but the data connector backing the model does not support ordering by nested fields (missing the ordering_by_nested_fields capability).

Source

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

        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"
    )]
    ModelV1OrderableFieldIsAnArrayType {
        model_name: Qualified<ModelName>,
        field_name: FieldName,
        field_type: QualifiedTypeReference,
    },
    #[error(
        "The order by expression '{order_by_expression_identifier}' used in model '{model_name}' contains a nested field '{nested_field_name}', however the data connector '{data_connector_name}' used in the model does not support ordering by nested fields"
    )]
    OrderByExpressionContainsUnsupportedNestedField {
        order_by_expression_identifier: Qualified<OrderByExpressionIdentifier>,
        model_name: Qualified<ModelName>,
        nested_field_name: FieldName,
        data_connector_name: Qualified<DataConnectorName>,
    },
    #[error(
        "Issue in order by expression '{order_by_expression_identifier}' used by model '{model_name}': {error}"
    )]
    OrderableRelationshipError {
        order_by_expression_identifier: Qualified<OrderByExpressionIdentifier>,
        model_name: Qualified<ModelName>,
        error: order_by_expressions::OrderableRelationshipError,
    },
    #[error(
        "The target model '{target_model_name}' of the orderable relationship '{relationship_name}' in order by expression '{order_by_expression_identifier}' used in model '{model_name}' must have a source"

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Remove the nested field from the order_by_expression
  2. Switch to a connector that supports ordering by nested fields
  3. Flatten the nested data into scalar columns in the underlying data source
Defensive patterns

Strategy: validation

Validate before calling

// check the connector capability before defining nested order_by expressions
assert!(connector.capabilities.ordering_by_nested_fields, "connector cannot order by nested fields");

Prevention

When it happens

Trigger: Defining an order_by_expression whose path goes through a nested object/array while using a connector that lacks nested-field ordering support.

Common situations: Using connectors like simple REST/Lambda connectors or older agent versions for models with nested order-by expressions.

Related errors


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