hasura/graphql-engine · error · ModelsIssue
The target command '{target_command_name}' of the orderable
Error message
The target command '{target_command_name}' of the orderable relationship '{relationship_name}' in order by expression '{order_by_expression_identifier}' used in model '{model_name}' must have a source What it means
An order_by_expression traverses an orderable relationship whose target command has no source, so ordering cannot be resolved for it.
Source
Thrown at v3/crates/metadata-resolve/src/stages/models/types.rs:150
},
#[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"
)]
OrderableRelationshipTargetModelMustHaveASource {
order_by_expression_identifier: Qualified<OrderByExpressionIdentifier>,
model_name: Qualified<ModelName>,
relationship_name: open_dds::relationships::RelationshipName,
target_model_name: Qualified<ModelName>,
},
#[error(
"The target command '{target_command_name}' of the orderable relationship '{relationship_name}' in order by expression '{order_by_expression_identifier}' used in model '{model_name}' must have a source"
)]
OrderableRelationshipTargetCommandMustHaveASource {
order_by_expression_identifier: Qualified<OrderByExpressionIdentifier>,
model_name: Qualified<ModelName>,
relationship_name: open_dds::relationships::RelationshipName,
target_command_name: Qualified<CommandName>,
},
}
impl ShouldBeAnError for ModelsIssue {
fn should_be_an_error(&self, flags: &open_dds::flags::OpenDdFlags) -> bool {
match self {
ModelsIssue::FunctionArgumentMappingIssue { .. } => false,
ModelsIssue::ModelV1OrderableFieldIsNotAScalarField { .. }
| ModelsIssue::ModelV1OrderableFieldIsAnArrayType { .. } => {
flags.contains(open_dds::flags::Flag::DisallowModelV1OrderingNonScalarFields)
}View on GitHub (pinned to 724551b9ae)
Solutions
- Define a source for the target command (connector operation/collection mapping)
- Retarget the relationship to a sourced model or command
- Drop the order_by_expression
Defensive patterns
Strategy: validation
Validate before calling
assert!(commands[&rel.target_command].source.is_some(), "target command has no source");
Prevention
- Ensure commands used as orderable relationship targets define a connector-backed source
When it happens
Trigger: Using an orderable relationship that targets a command which lacks a source definition in metadata.
Common situations: Commands defined without an underlying data connector operation, then referenced by order_by_expressions.
Related errors
- The target model '{target_model_name}' of the orderable rela
- Issue in order by expression '{order_by_expression_identifie
- the relationship '{relationship_name}' is defined more than
- the comparable relationship '{relationship_name}' for the op
- the comparable relationship '{relationship_name}' for the op
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/2d43731ed1de4a58.
Report an issue: GitHub.