Budibase/budibase · error · HTTPError

Grouping by fields of type "${targetSchema.type}" is not sup

Error message

Grouping by fields of type "${targetSchema.type}" is not supported

What it means

Thrown by guardCalculationViewSchema when a calculation view declares a group-by field whose table schema type is not in the set of types that support grouping (via canGroupBySchema). Budibase views can only group by certain field types (e.g. strings, options); grouping by types like JSON, attachments, or formulas is rejected with a 400. It is a static config validation, not a runtime data failure.

Source

Thrown at packages/server/src/sdk/workspace/views/index.ts:208

      throw new HTTPError(
        `Calculation field "${name}" references field "${schema.field}" which is not a numeric field`,
        400
      )
    }
  }

  const groupByFields = helpers.views.basicFields(view)
  for (const groupByFieldName of Object.keys(groupByFields)) {
    const targetSchema = table.schema[groupByFieldName]
    if (!targetSchema) {
      throw new HTTPError(
        `Group by field "${groupByFieldName}" does not exist in the table schema`,
        400
      )
    }

    if (!canGroupBySchema(targetSchema)) {
      throw new HTTPError(
        `Grouping by fields of type "${targetSchema.type}" is not supported`,
        400
      )
    }
  }
}

async function guardViewSchema(
  tableId: string,
  view: Omit<ViewV2, "id" | "version">
) {
  const table = await sdk.tables.getTable(tableId)

  if (helpers.views.isCalculationView(view)) {
    await guardCalculationViewSchema(table, view)
  } else {
    if (helpers.views.hasCalculationFields(view)) {
      throw new HTTPError(

View on GitHub (pinned to a81a902e9a)

Solutions

  1. Change the groupBy field in the view to one whose type is supported (e.g. string, number, boolean, option).
  2. If the field must stay, change the table column type to a groupable type or add a supported computed/text column to group on.
  3. Remove the groupBy from the view if grouping is not essential.
  4. Check canGroupBySchema in packages/server for the exact supported type list before configuring.

Example fix

// before
view.groupBy = "metadata" // metadata: { type: "json" }
// after
view.groupBy = "status" // status: { type: "string" }
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED = ["string", "number", "boolean", "longform", "options"]
if (view.groupBy && !SUPPORTED.includes(table.schema[view.groupBy]?.type)) {
  throw new Error(`Cannot group by ${view.groupBy}`)
}
await sdk.views.create(view)

Type guard

function isGroupable(field: FieldSchema | undefined): boolean {
  return !!field && ["string", "number", "boolean", "longform", "options"].includes(field.type)
}

Try / catch

try {
  await sdk.views.update(view)
} catch (e) {
  if (e instanceof HTTPError && e.status === 400 && e.message.includes("Grouping by fields of type")) {
    view.groupBy = undefined
    await sdk.views.update(view)
  } else { throw e }
}

Prevention

When it happens

Trigger: Creating or updating a calculation view (sdk.views.create/update -> guardViewSchema) with view.groupBy set to a field whose table.schema[fieldName].type is unsupported by canGroupBySchema.

Common situations: Grouping by a formula, JSON, multi-select, attachment, or link field added to the table after the view was configured; copying view configs between tables with different field types; UI workarounds that bypass type filtering.

Related errors


AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29). Data as JSON: /api/errors/14d9ca9294f64eec. Report an issue: GitHub.