Budibase/budibase · error · HTTPError
Calculation field "${name}" references field "${schema.field
Error message
Calculation field "${name}" references field "${schema.field}" which is not a numeric field What it means
Non-COUNT calculations (sum, avg, min, max, etc.) require a numeric target column. The guard accepts numeric types and numeric static-formula fields but throws 400 if the referenced field is e.g. a string or date. COUNT is exempt because it counts rows regardless of type.
Source
Thrown at packages/server/src/sdk/workspace/views/index.ts:190
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
)
}
}
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(View on GitHub (pinned to a81a902e9a)
Solutions
- Point the calculation at a numeric column (or numeric static formula field)
- Use COUNT if you only need row counts on the non-numeric field
- Change the column type to number if the data is genuinely numeric
- Cast/coalesce the value into a numeric formula column first
Example fix
// before
calculations: { nameSum: { field: "customer_name", calculationType: "sum" } }
// after
calculations: { nameCount: { field: "customer_name", calculationType: "count" } }
// or: amountSum: { field: "amount", 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.calculationType === "count") continue
const s = table.schema[c.field]
if (!isNumeric(s?.type) && !isNumericStaticFormula(s)) throw new Error(`${c.field} is not numeric`)
} Type guard
function isNumericTarget(s: TableSchema[string] | undefined): boolean {
return !!s && (isNumeric(s.type) || isNumericStaticFormula(s))
} Try / catch
try { await sdk.views.create(tableId, view) }
catch (e) {
if (e instanceof HTTPError && e.status === 400 && /not a numeric field/.test(e.message)) {
// switch calculation to count or pick a numeric field, then retry
} else throw e
} Prevention
- Restrict non-count calculation targets to numeric columns in the UI
- Re-validate views when column types change
- Prefer COUNT when the column is not numeric
When it happens
Trigger: Defining sum/avg/min/max on a string, boolean, date, or non-numeric formula column in a calculation view.
Common situations: Selecting the wrong column in the builder; column type changed from number to string after the view was made; formula fields that don't resolve to numeric static formulas.
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
- Cannot insert rows through a calculation view
AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29).
Data as JSON: /api/errors/ecfa1aec6264c9c4.
Report an issue: GitHub.