hasura/graphql-engine · error · Error

Unsupported field type "array"

Error message

Unsupported field type "array"

What it means

Companion to the 'object' case: the SQLite agent's field projection generator rejects fields of `type: 'array'`. Arrays have no direct SQL representation in the agent's JSON_OBJECT-based generation, so they throw a plain Error before SQL is produced.

Source

Thrown at dc-agents/sqlite/src/query.ts:144

): string {
  const result = Object.entries(fields)
    .map(([fieldName, field]) => {
      switch (field.type) {
        case 'column':
          return `${escapeString(fieldName)}, ${escapeIdentifier(field.column)}`;
        case 'relationship':
          const relationships = find_relationships(all_relationships, target);
          const rel = relationships.relationships[field.relationship];
          if (rel === undefined) {
            throw new Error(
              `Couldn't find relationship ${field.relationship} for field ${fieldName} on target ${JSON.stringify(target)}`,
            );
          }
          return `'${fieldName}', ${relationship(all_relationships, rel, field, tableAlias)}`;
        case 'object':
          throw new Error('Unsupported field type "object"');
        case 'array':
          throw new Error('Unsupported field type "array"');
        default:
          return unreachable(field['type']);
      }
    })
    .join(', ');

  return tag('json_object', `JSON_OBJECT(${result})`);
}

export function where_clause(
  relationships: Relationships[],
  expression: Expression,
  queryTarget: Target,
  queryTableAlias: string,
): string {
  const generateWhere = (
    expression: Expression,
    currentTarget: Target,

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Replace array fields with relationships to the row-valued table (which produce JSON arrays via json_group_array)
  2. Materialize the array as a JSON column and select it as a plain column
  3. Upgrade the agent if array support was added in a later version

Example fix

// before
{ fields: { tracks: { type: 'array', of: {...} } } }
// after
{ fields: { tracks: { type: 'relationship', relationship: 'album_tracks', query: {...} } } }
Defensive patterns

Strategy: type-guard

Validate before calling

for (const [k, f] of Object.entries(fields)) if (f.type === 'array') throw new Error(`Field ${k} uses unsupported type 'array'`);

Type guard

const isSupportedField = (f: Field): f is ColumnField | RelationshipField => f.type === 'column' || f.type === 'relationship';

Prevention

When it happens

Trigger: A query field selection containing `{ type: 'array', ... }`, such as a list-valued expression or nested array projection forwarded from a richer query API.

Common situations: Porting queries from NoSQL-ish or GraphQL connectors that support array fields; stale metadata declaring array fields; client/server schema drift after upgrading the query language.

Related errors


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