hasura/graphql-engine · error · OrderableRelationshipError

The orderable relationship

Error message

The orderable relationship '{relationship_name}' defined for '{orderable_type}' is a remote relationship and remote relationships are not supported in ordering

What it means

Thrown when an orderable relationship defined for a type is a remote relationship. Remote relationships span different data sources and cannot be evaluated inside ORDER BY clauses, so metadata resolution rejects them.

Solutions

  1. Find the orderable relationship named in the error on the given type in your OpenDD metadata
  2. If it is a remote relationship, remove it from the ordering configuration (orderable relationships / order_by_expressions)
  3. Replace it with an equivalent local (same data connector) relationship if ordering is required

Example fix

// before (OpenDD yaml)
orderable_relationships:
  - relationship_name: remoteAuthors
// after: remove the remote relationship, keep only local ones
orderable_relationships:
  - relationship_name: localAuthors
Defensive patterns

Strategy: validation

Validate before calling

for (const rel of orderableRelationships) {
  const def = relationships[rel.relationship_name];
  if (def?.target_source?.type !== 'localDataConnector') {
    throw new Error(`${rel.relationship_name} is remote and cannot be orderable`);
  }
}

Type guard

const isLocalRelationship = (r) => r.target_source?.data_connector_name !== undefined;

Prevention

When it happens

Trigger: Adding a relationship to a type's orderable_relationships (or order_by_expressions using it) where the relationship targets a remote schema/data connector instead of a local data connector relationship.

Common situations: Copy-pasting an orderable relationship configuration onto a type that also has remote relationships; migrating a relationship from local to remote while leaving it listed as orderable.

Related errors


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

Appendix: source

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

    #[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"
    )]
    RelationshipsNotSupported {
        orderable_type: Qualified<CustomTypeName>,
        relationship_name: RelationshipName,
        data_connector_name: Qualified<open_dds::data_connector::DataConnectorName>,
    },
    #[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 nested relationships in ordering"
    )]
    NestedRelationshipsNotSupported {

View on GitHub (pinned to 724551b9ae)