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

  1. Check the schema's relationships for the segment named in target_path and confirm each target is { type: 'table', name: ... }.
  2. Flatten the order-by to use only table-target relationships, or sort on a column of the current table.
  3. 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

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


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