Budibase/budibase · error · HTTPError

Field "${field}" must be visible if you want to make it read

Error message

Field "${field}" must be visible if you want to make it readonly

What it means

checkReadonlyFields enforces that a view field marked readonly must also be visible. A hidden-but-readonly field is contradictory config (nothing renders to be readonly), so a 400 HTTPError is thrown.

Source

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

) {
  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) {
    const viewSchemaField = view.schema?.[view.primaryDisplay]

    if (!viewSchemaField?.visible) {
      throw new HTTPError(
        `You can't hide "${view.primaryDisplay}" because it is the display column.`,
        400
      )
    }

View on GitHub (pinned to a81a902e9a)

Solutions

  1. Set visible: true for the readonly field in the view schema.
  2. Or set readonly: false if the field should be hidden.
  3. Audit the view schema so visible and readonly flags are consistent.

Example fix

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

Strategy: validation

Validate before calling

for (const [f, s] of Object.entries(view.schema ?? {})) {
  if (s.readonly && !s.visible) throw new Error(`${f} readonly but hidden`)
}

Type guard

function readonlyFieldsVisible(view: ViewV2): boolean {
  return Object.values(view.schema ?? {}).every(s => !s.readonly || s.visible === true)
}

Try / catch

try {
  await sdk.views.update(view)
} catch (e) {
  if (e instanceof HTTPError && e.status === 400 && e.message.includes("must be visible if you want to make it readonly")) {
    // set visible:true on offending fields, then retry
  } else { throw e }
}

Prevention

When it happens

Trigger: create/update via guardViewSchema where for some field viewSchema[field].readonly === true and viewSchema[field].visible !== true (undefined/false).

Common situations: Toggling visible=false in the UI while readonly stays true; hand-built view payloads; migration scripts that set visible flags without checking readonly.

Related errors


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