hasura/graphql-engine · error · Error

Unsupported field type "object"

Error message

Unsupported field type "object"

What it means

The JSON_OBJECT field generator in the SQLite agent only supports `column` and `relationship` field types. A field with `type: 'object'` (a nested anonymous object selection, common in GraphQL-style APIs) is explicitly rejected because the agent cannot map it onto SQLite SQL generation.

Source

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

  target: Target,
  tableAlias: string,
): 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 = (

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Flatten object fields into explicit column/relationship fields
  2. Model the nested structure as a relationship to another table or an interpolated target
  3. Upgrade the agent if a newer version supports object fields

Example fix

// before
{ fields: { address: { type: 'object', fields: { city: {type:'column', column:'city'} } } } }
// after
{ fields: { city: { type: 'column', column: 'city' } } }
Defensive patterns

Strategy: type-guard

Validate before calling

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

Type guard

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

Prevention

When it happens

Trigger: Sending a field selection containing `{ type: 'object', fields: {...} }` to the query endpoint — e.g. a client that supports nested object projections forwarding a shape the SQLite agent doesn't model.

Common situations: Sharing query-building code with connectors that support object fields; metadata modeling nested types; version changes that added object fields to the query language but not to this agent.

Related errors


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