hasura/graphql-engine · error · ModelsIssue
The orderable field '{field_name}' in model '{model_name}' i
Error message
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 What it means
In a v1 model, a field listed in orderable_fields is not a scalar field (e.g. an object or relationship) so it cannot be used for ordering. v1 models only support ordering by scalar fields.
Source
Thrown at v3/crates/metadata-resolve/src/stages/models/types.rs:108
}
#[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"
)]
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"
)]View on GitHub (pinned to 724551b9ae)
Solutions
- Remove the non-scalar field from orderable_fields
- Upgrade to version 2 Models and use OrderByExpressions to order by nested fields
- Restructure the model so the field is a scalar
Example fix
# before
orderable_fields:
- field: user # object field
# after (v2 model)
order_by_expressions:
- name: user_name
expression:
field: user
then: name
Defensive patterns
Strategy: validation
Validate before calling
// only scalar fields may be orderable in v1
for f in &model.orderable_fields {
assert!(is_scalar(&model.type_.fields[f]), "field {} is not scalar", f);
} Type guard
const isScalarField = (t) => t.type.kind === 'scalar';
Prevention
- Use v2 models with order_by_expressions for nested ordering
- Validate orderable_fields against the type schema in CI
When it happens
Trigger: Adding a nested/object-typed field to orderable_fields in a model whose type is an object or object-array rather than a scalar.
Common situations: Trying to expose ordering on a nested field with v1 model syntax; migrating object models where relationships were mistakenly marked orderable.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- The orderable field '{field_name}' in model '{model_name}' i
- filter input type name graphql configuration must be specifi
- the model {model_name} has a duplicate root field in the Gra
- model arguments graphql input configuration has been specifi
- %s: %d %s
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/7af0e0b6755d2675.
Report an issue: GitHub.