hasura/graphql-engine · error · Error
makeGetOrderByElementValue: Only table relationships current
Error message
makeGetOrderByElementValue: Only table relationships currently supported
What it means
While resolving an order-by element across relationships, the engine looks up the relationship for the first path segment and dispatches on the relationship target's type. Only table targets are implemented; any other target type falls through to this error.
Source
Thrown at dc-agents/reference/src/query.ts:545
};
const subquery = addRelationshipFilterToQuery(row, relationship, query);
if (subquery === null) {
return null;
} else {
const relationshipTarget = relationship.target;
switch (relationshipTarget.type) {
case 'table':
const queryResponse = performQuery(
{ type: 'table', table: relationshipTarget.name },
subquery,
);
return extractResultFromOrderByElementQueryResponse(
innerOrderByElement,
queryResponse,
);
default:
throw new Error(
'makeGetOrderByElementValue: Only table relationships currently supported',
);
}
}
}
};
const sortRows = (
rows: Record<string, RawScalarValue>[],
orderBy: OrderBy,
getOrderByElementValue: (
orderByElement: OrderByElement,
row: Record<string, RawScalarValue>,
orderByRelations: Record<RelationshipName, OrderByRelation>,
) => RawScalarValue,
): Record<string, RawScalarValue>[] =>
rows
.map<[Record<string, RawScalarValue>, RawScalarValue[]]>((row) => [row, []])View on GitHub (pinned to 724551b9ae)
Solutions
- Check the schema's relationships for the segment named in target_path and confirm each target is { type: 'table', name: ... }.
- Flatten the order-by to use only table-target relationships, or sort on a column of the current table.
- Fix the backend/metadata producing non-table relationship targets.
Defensive patterns
Strategy: validation
Validate before calling
const rel = relationships[orderBy.target_path[0]];
if (rel && rel.target.type !== 'table') throw new Error('order_by path requires table relationship'); Type guard
const isTableRelationship = (r: Relationship | undefined): r is { target: { type: 'table'; name: string } } =>
r?.target.type === 'table'; Prevention
- Check relationship target types in the schema before using them in order_by paths
- Keep schemas limited to table targets for this reference agent
When it happens
Trigger: An order_by with a non-empty target_path whose first segment names a relationship whose target type is not 'table' in the schema.
Common situations: Custom connector backends emitting non-table relationship targets; schema metadata drift or malformed relationship definitions; hand-crafted schemas with unsupported target types.
Related errors
- Cannot perform an order by target of type ${orderByElement.t
- makePerformExistsSubquery: only table relationships currentl
- Unexpected number of rows (${rows.length}) returned by order
- Column order by target path did not end in a column field va
- Found a column field value in the middle of a order by targe
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/c66c4886d52944cd.
Report an issue: GitHub.