Budibase/budibase · error · HTTPError
Calculation field "${name}" references field "${schema.field
Error message
Calculation field "${name}" references field "${schema.field}" which does not exist in the table schema What it means
A calculation field's field property must reference a column that exists in the underlying table's schema. If table.schema[schema.field] is undefined the guard throws 400, because aggregates cannot run against unknown columns.
Source
Thrown at packages/server/src/sdk/workspace/views/index.ts:178
if (Object.keys(calculationFields).length > 5) {
throw new HTTPError(
"Calculation views can only have a maximum of 5 fields",
400
)
}
for (const name of Object.keys(calculationFields)) {
const schema = calculationFields[name]
if (!schema.field) {
throw new HTTPError(
`Calculation field "${name}" is missing a "field" property`,
400
)
}
const targetSchema = table.schema[schema.field]
if (!targetSchema) {
throw new HTTPError(
`Calculation field "${name}" references field "${schema.field}" which does not exist in the table schema`,
400
)
}
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
)
}
}
View on GitHub (pinned to a81a902e9a)
Solutions
- Update the calculation to reference an existing column name from table.schema
- Recreate/re-point the view after the column rename
- Restore the deleted column or remove the calculation field
- Diff the view's field references against the current table schema before saving
Example fix
// before
calculations: { total: { field: "revenu", calculationType: "sum" } } // typo
// after
calculations: { total: { field: "revenue", calculationType: "sum" } } Defensive patterns
Strategy: validation
Validate before calling
const table = await sdk.tables.getTable(tableId)
for (const c of Object.values(view.calculations ?? {})) {
if (!(c.field in table.schema)) throw new Error(`Field ${c.field} not in table schema`)
} Type guard
function fieldExists(table: Table, field: string): boolean { return field in table.schema } Try / catch
try { await sdk.views.update(tableId, view) }
catch (e) {
if (e instanceof HTTPError && e.status === 400 && /does not exist in the table schema/.test(e.message)) {
// reload schema, remap fields, retry
} else throw e
} Prevention
- Validate calculation targets against a freshly loaded table schema
- Re-check views after column renames/deletes
- Use schema-aware pickers instead of free-text field input
When it happens
Trigger: Creating/updating a calculation view where the referenced column was renamed or deleted from the table, or the field name is misspelled / wrong-cased.
Common situations: Renaming a SQL column after building views on it; deleting a column while views still reference it; typos in scripted view creation; case-sensitive mismatch on external tables.
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
- Duplicate calculation on field "${schema.field}", calculatio
- Duplicate calculation on field "${schema.field}", calculatio
- Calculation field "${name}" is missing a "field" property
- Calculation field "${name}" references field "${schema.field
- Group by field "${groupByFieldName}" does not exist in the t
AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29).
Data as JSON: /api/errors/94421d4903ab4eb3.
Report an issue: GitHub.