Budibase/budibase · error · HTTPError
Group by field "${groupByFieldName}" does not exist in the t
Error message
Group by field "${groupByFieldName}" does not exist in the table schema What it means
Every group-by (basic) field of a calculation view must exist in the underlying table schema. If table.schema[groupByFieldName] is missing the guard throws 400 before even checking whether the type is groupable.
Source
Thrown at packages/server/src/sdk/workspace/views/index.ts:201
const isCount = schema.calculationType === CalculationType.COUNT
if (
!isCount &&
!isNumeric(targetSchema.type) &&
!isNumericStaticFormula(targetSchema)
) {
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">
) {View on GitHub (pinned to a81a902e9a)
Solutions
- Update the group-by list to use existing column names from table.schema
- Remove the stale group-by field from the view
- Restore the renamed/deleted column or migrate the view after schema changes
Example fix
// before groupBy: ["region "], // trailing space / stale name // after groupBy: ["region"] // must exist in table.schema
Defensive patterns
Strategy: validation
Validate before calling
const table = await sdk.tables.getTable(tableId)
for (const g of Object.keys(view.groupBy ?? {})) {
if (!(g in table.schema)) throw new Error(`Group-by field ${g} not in table schema`)
} Type guard
function canGroup(table: Table, field: string): boolean {
const s = table.schema[field]
return !!s && canGroupBySchema(s)
} Try / catch
try { await sdk.views.update(tableId, view) }
catch (e) {
if (e instanceof HTTPError && e.status === 400 && /Group by field .* does not exist/.test(e.message)) {
// refresh schema, fix groupBy list, retry
} else throw e
} Prevention
- Validate group-by fields against current table schema before saving
- Refresh views after external schema syncs
- Use schema-driven multi-select for group-by fields
When it happens
Trigger: Creating/updating a calculation view whose group-by list references a renamed or deleted column, or contains a misspelled field name.
Common situations: Grouping by a column removed from the table; schema drift on external SQL tables; scripted view definitions with stale field names; case mismatches.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- Calculation field "${name}" references field "${schema.field
- Cannot insert rows through a calculation view
- Duplicate calculation on field "${schema.field}", calculatio
- Duplicate calculation on field "${schema.field}", calculatio
- Calculation views can only have a maximum of 5 fields
AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29).
Data as JSON: /api/errors/409d15fd43163b61.
Report an issue: GitHub.