hasura/graphql-engine · error · OrderByExpressionError

{0}

Error message

{0}

What it means

A transparent wrapper (#[error("{0}")]) that forwards errors from the GraphQL configuration subsystem (graphql_config::GraphqlConfigError) while resolving order-by expressions. The displayed message is the underlying GraphQL configuration error verbatim.

Source

Thrown at v3/crates/metadata-resolve/src/stages/order_by_expressions/error.rs:66

        field_name: FieldName,
    },
    #[error(
        "The order by expression {order_by_expression_name} referenced in orderable relationship {relationship_name} has not been defined"
    )]
    UnknownOrderByExpressionNameInOrderableRelationship {
        order_by_expression_name: OrderByExpressionName,
        relationship_name: RelationshipName,
    },
    #[error(
        "The type of the order by expression {order_by_expression_name} referenced in field {field_name} does not match the field type. Order by expression type: {order_by_expression_type}; field type: {field_type}. "
    )]
    OrderableFieldTypeError {
        order_by_expression_name: OrderByExpressionName,
        order_by_expression_type: TypeName,
        field_type: QualifiedBaseType,
        field_name: FieldName,
    },
    #[error("{0}")]
    GraphqlConfigError(#[from] graphql_config::GraphqlConfigError),
    #[error("{message}")]
    UnsupportedFeature { message: String },
}

#[derive(Debug, thiserror::Error)]
#[allow(clippy::enum_variant_names)]
pub enum OrderableRelationshipError {
    #[error(
        "The orderable relationship '{relationship_name}' defined for '{orderable_type}' is a remote relationship and remote relationships are not supported in ordering"
    )]
    RemoteRelationshipsNotSupported {
        orderable_type: Qualified<CustomTypeName>,
        relationship_name: RelationshipName,
    },
    #[error(
        "The orderable relationship '{relationship_name}' defined for '{orderable_type}' is not supported in ordering because the data connector '{data_connector_name}' does not support relationships"
    )]

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Read the forwarded message — it is the actual GraphqlConfigError text and names the offending name/config
  2. Rename fields/types/expressions to be GraphQL-name-compliant (alphanumeric + underscore, not starting with a digit)
  3. Adjust the GraphQL configuration settings that caused the rejection
Defensive patterns

Strategy: validation

Validate before calling

// Reject names invalid in GraphQL before applying metadata
const gqlName = /^[A-Za-z_][A-Za-z0-9_]*$/;
for (const n of allNamesInMetadata(md)) if (!gqlName.test(n)) throw new Error(`Invalid GraphQL name: ${n}`);

Prevention

When it happens

Trigger: Order-by expression resolution reads GraphQL naming/configuration rules (e.g. converting names to GraphQL-compatible form) and the graphql config layer rejects a name or setting — invalid GraphQL name characters, conflicting generated names, or disabled features.

Common situations: Field or type names containing characters invalid in GraphQL; naming collisions after sanitization; graphql config flags (like specific naming conventions) incompatible with the defined expressions.

Related errors


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