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
- Remove the stale field from the view schema.
- Re-add the field to the table schema if it should exist.
- Correct the field name spelling/casing in the view to match table.schema.
- 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
- Rebuild view schemas from the current table schema before updates
- Remove view references when deleting/renaming table columns
- Validate field names against table.schema after imports/migrations
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
- Grouping by fields of type "${targetSchema.type}" is not sup
- Calculation fields are not allowed in non-calculation views
- Field "${field}" must be visible if you want to make it read
- You can't hide "${view.primaryDisplay}" because it is the di
- You can't hide "${field.name}" because it is a required fiel
AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29).
Data as JSON: /api/errors/55f605842c659348.
Report an issue: GitHub.