{"record":{"id":"80c7dc0d94a2a91c","repo":"hasura/graphql-engine","slug":"the-orderable-field-field-name-in-model-mode-80c7dc","errorCode":null,"errorMessage":"The orderable field '{field_name}' in model '{model_name}' is an array type (type: {field_type}) and therefore cannot be used for ordering","messagePattern":"The orderable field '(.+?)' in model '(.+?)' is an array type \\(type: (.+?)\\) and therefore cannot be used for ordering","errorType":"validation","errorClass":"ModelsIssue","httpStatus":null,"severity":"error","filePath":"v3/crates/metadata-resolve/src/stages/models/types.rs","lineNumber":116,"sourceCode":"pub enum ModelsIssue {\n    #[error(\n        \"An issue occurred while mapping arguments in the model {model_name:} to the collection {collection_name:} in the data connector {data_connector_name:}: {issue:}\"\n    )]\n    FunctionArgumentMappingIssue {\n        data_connector_name: Qualified<DataConnectorName>,\n        model_name: Qualified<ModelName>,\n        collection_name: CollectionName,\n        issue: ArgumentMappingIssue,\n    },\n    #[error(\n        \"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\"\n    )]\n    ModelV1OrderableFieldIsNotAScalarField {\n        model_name: Qualified<ModelName>,\n        field_name: FieldName,\n        field_type: QualifiedTypeReference,\n    },\n    #[error(\n        \"The orderable field '{field_name}' in model '{model_name}' is an array type (type: {field_type}) and therefore cannot be used for ordering\"\n    )]\n    ModelV1OrderableFieldIsAnArrayType {\n        model_name: Qualified<ModelName>,\n        field_name: FieldName,\n        field_type: QualifiedTypeReference,\n    },\n    #[error(\n        \"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\"\n    )]\n    OrderByExpressionContainsUnsupportedNestedField {\n        order_by_expression_identifier: Qualified<OrderByExpressionIdentifier>,\n        model_name: Qualified<ModelName>,\n        nested_field_name: FieldName,\n        data_connector_name: Qualified<DataConnectorName>,\n    },\n    #[error(\n        \"Issue in order by expression '{order_by_expression_identifier}' used by model '{model_name}': {error}\"","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/metadata-resolve/src/stages/models/types.rs#L98-L134","documentation":"An orderable field in a v1 model has an array type, and array fields cannot be used for ordering.","triggerScenarios":"Listing an array/list-typed field (e.g. tags: [String]) in orderable_fields of a v1 model.","commonSituations":"Marking list columns as orderable in generated or hand-edited model metadata.","solutions":["Remove the array field from orderable_fields","Order by a scalar field instead (e.g. array_length or a related scalar in v2)"],"exampleFix":"# before\norderable_fields:\n  - field: tags   # array\n# after\norderable_fields:\n  - field: created_at\n","handlingStrategy":"validation","validationCode":"// reject array-typed orderable fields before applying\nfor f in &model.orderable_fields {\n    assert!(!is_array(&model.type_.fields[f]), \"array field {} not orderable\", f);\n}","typeGuard":"const isArrayType = (t) => t.type.kind === 'array' || t.type.of?.kind === 'array';","tryCatchPattern":null,"preventionTips":["Don't mark list columns orderable","Linter rule: orderable fields must be scalar and non-array"],"tags":["hasura","models","orderable-fields","array-type"],"backgroundTag":"schema-validation-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}