Budibase/budibase · error · HTTPError

Calculation field " " is missing a "field" property

Error message

Calculation field "${name}" is missing a "field" property

What it means

Every calculation field must declare which column it aggregates via the field property. When a calculation entry lacks field (empty/undefined), the guard rejects it with 400, since the aggregate would have no target column.

Solutions

  1. Add the field property naming an existing table column to every calculation entry
  2. Validate the payload client-side before submitting
  3. Fix the producing code/form that generated the incomplete entry

Example fix

// before
calculations: { total: { calculationType: "sum" } }
// after
calculations: { total: { field: "amount", calculationType: "sum" } }
Defensive patterns

Strategy: validation

Validate before calling

for (const [name, c] of Object.entries(view.calculations ?? {})) {
  if (!c.field) throw new Error(`Calculation "${name}" missing field`)
}

Type guard

function hasField(c: unknown): c is { field: string; calculationType: CalculationType } {
  return typeof c === "object" && c !== null && typeof (c as any).field === "string" && (c as any).field.length > 0
}

Try / catch

try { await sdk.views.create(tableId, view) }
catch (e) {
  if (e instanceof HTTPError && e.status === 400 && /missing a "field" property/.test(e.message)) {
    // fix payload and retry
  } else throw e
}

Prevention

When it happens

Trigger: A calculation view schema entry like { name: { calculationType: "sum" } } with no field key, e.g. from hand-written JSON or a builder state bug.

Common situations: Manual API calls omitting field; deserialization dropping empty properties; partially filled form submitted; template copy where field was never set.

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


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

Appendix: source

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

  table: Table,
  view: Omit<ViewV2, "id" | "version">
) {
  const calculationFields = helpers.views.calculationFields(view)

  guardDuplicateCalculationFields(view)
  guardDuplicateCountDistinctFields(view)

  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)

View on GitHub (pinned to a81a902e9a)