Budibase/budibase · error · HTTPError

You can't hide "${view.primaryDisplay}" because it is the di

Error message

You can't hide "${view.primaryDisplay}" because it is the display column.

What it means

checkDisplayField ensures the table's primary display column is always visible in the view. Hiding the display column would break row identification in the UI, so a 400 HTTPError is thrown when view.schema[primaryDisplay].visible is falsy while primaryDisplay is set.

Source

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

    }

    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
      )
    }
  }
}

function checkRequiredFields(
  table: Table,
  view: Omit<ViewV2, "id" | "version">
) {
  const existingView = table.views?.[view.name] as ViewV2 | undefined
  for (const field of Object.values(table.schema)) {
    if (!helpers.schema.isRequired(field.constraints)) {
      continue
    }

    const viewSchemaField = view.schema?.[field.name]

View on GitHub (pinned to a81a902e9a)

Solutions

  1. Set visible: true for view.schema[view.primaryDisplay].
  2. If the column must be hidden, change the table's primary display column to another field first.
  3. If primaryDisplay is no longer needed in the view, unset view.primaryDisplay.

Example fix

// before
view.schema[view.primaryDisplay].visible = false
// after
view.schema[view.primaryDisplay].visible = true
Defensive patterns

Strategy: validation

Validate before calling

if (view.primaryDisplay && view.schema?.[view.primaryDisplay]?.visible !== true) {
  view.schema[view.primaryDisplay].visible = true
}

Type guard

function displayVisible(view: Omit<ViewV2, "id" | "version">): boolean {
  return !view.primaryDisplay || view.schema?.[view.primaryDisplay]?.visible === true
}

Try / catch

try {
  await sdk.views.update(view)
} catch (e) {
  if (e instanceof HTTPError && e.status === 400 && e.message.includes("because it is the display column")) {
    view.schema[view.primaryDisplay].visible = true
    await sdk.views.update(view)
  } else { throw e }
}

Prevention

When it happens

Trigger: create/update via guardViewSchema with view.primaryDisplay set and view.schema[primaryDisplay] either missing visible or visible:false.

Common situations: Bulk-hiding columns in the builder including the display column; copying view config that hides the display field; scripts that set visible flags without checking primaryDisplay.

Related errors


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