Budibase/budibase · error · HTTPError

Field "${field}" is not valid for the requested table

Error message

Field "${field}" is not valid for the requested table

What it means

checkReadonlyFields iterates the view's non-calculation schema fields and verifies each exists in the underlying table's schema. If a view references a field absent from table.schema, the view config is stale/invalid and a 400 HTTPError is thrown.

Source

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

  ensureValidPrimaryDisplay(view, table)

  checkDisplayField(view)
}

async function checkReadonlyFields(
  table: Table,
  view: Omit<ViewV2, "id" | "version">
) {
  const viewSchema = view.schema || {}
  for (const field of Object.keys(viewSchema)) {
    const viewFieldSchema = viewSchema[field]
    if (helpers.views.isCalculationField(viewFieldSchema)) {
      continue
    }

    const tableFieldSchema = table.schema[field]
    if (!tableFieldSchema) {
      throw new HTTPError(
        `Field "${field}" is not valid for the requested table`,
        400
      )
    }

    if (viewSchema[field].readonly) {
      if (!viewSchema[field].visible) {
        throw new HTTPError(
          `Field "${field}" must be visible if you want to make it readonly`,
          400
        )
      }
    }
  }
}

function checkDisplayField(view: Omit<ViewV2, "id" | "version">) {
  if (view.primaryDisplay) {

View on GitHub (pinned to a81a902e9a)

Solutions

  1. Remove the stale field from the view schema.
  2. Re-add the field to the table schema if it should exist.
  3. Correct the field name spelling/casing in the view to match table.schema.
  4. Recreate the view from the current table schema.

Example fix

// before
view.schema["nmae"] = { visible: true, readonly: false }
// after
view.schema["name"] = { visible: true, readonly: false } // matches table.schema
Defensive patterns

Strategy: validation

Validate before calling

const valid = Object.keys(view.schema).filter(f => !helpers.views.isCalculationField(view.schema[f])).every(f => !!table.schema[f])
if (!valid) throw new Error("view schema references unknown table fields")

Type guard

function fieldsExistInTable(view: ViewV2, table: Table): boolean {
  return Object.keys(view.schema).every(f => f in table.schema)
}

Try / catch

try {
  await sdk.views.update(view)
} catch (e) {
  if (e instanceof HTTPError && e.status === 400 && e.message.includes("is not valid for the requested table")) {
    const field = /Field "(.+?)"/.exec(e.message)?.[1]
    if (field) delete view.schema[field]
    await sdk.views.update(view)
  } else { throw e }
}

Prevention

When it happens

Trigger: create/update via guardViewSchema where view.schema contains a field name not present in table.schema — e.g. the column was deleted from the table but the view still references it, or the field name is misspelled.

Common situations: Deleting/renaming a table column while a view still lists it; importing view definitions from another app/table; case-sensitive name mismatch.

Related errors


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