{"record":{"id":"ecd6a2c1815af352","repo":"Budibase/budibase","slug":"you-can-t-hide-view-primarydisplay-because-it","errorCode":null,"errorMessage":"You can't hide \"${view.primaryDisplay}\" because it is the display column.","messagePattern":"You can't hide \"(.+?)\" because it is the display column\\.","errorType":"validation","errorClass":"HTTPError","httpStatus":400,"severity":"error","filePath":"packages/server/src/sdk/workspace/views/index.ts","lineNumber":282,"sourceCode":"    }\n\n    if (viewSchema[field].readonly) {\n      if (!viewSchema[field].visible) {\n        throw new HTTPError(\n          `Field \"${field}\" must be visible if you want to make it readonly`,\n          400\n        )\n      }\n    }\n  }\n}\n\nfunction checkDisplayField(view: Omit<ViewV2, \"id\" | \"version\">) {\n  if (view.primaryDisplay) {\n    const viewSchemaField = view.schema?.[view.primaryDisplay]\n\n    if (!viewSchemaField?.visible) {\n      throw new HTTPError(\n        `You can't hide \"${view.primaryDisplay}\" because it is the display column.`,\n        400\n      )\n    }\n  }\n}\n\nfunction checkRequiredFields(\n  table: Table,\n  view: Omit<ViewV2, \"id\" | \"version\">\n) {\n  const existingView = table.views?.[view.name] as ViewV2 | undefined\n  for (const field of Object.values(table.schema)) {\n    if (!helpers.schema.isRequired(field.constraints)) {\n      continue\n    }\n\n    const viewSchemaField = view.schema?.[field.name]","sourceCodeStart":264,"sourceCodeEnd":300,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/server/src/sdk/workspace/views/index.ts#L264-L300","documentation":"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.","triggerScenarios":"create/update via guardViewSchema with view.primaryDisplay set and view.schema[primaryDisplay] either missing visible or visible:false.","commonSituations":"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.","solutions":["Set visible: true for view.schema[view.primaryDisplay].","If the column must be hidden, change the table's primary display column to another field first.","If primaryDisplay is no longer needed in the view, unset view.primaryDisplay."],"exampleFix":"// before\nview.schema[view.primaryDisplay].visible = false\n// after\nview.schema[view.primaryDisplay].visible = true","handlingStrategy":"validation","validationCode":"if (view.primaryDisplay && view.schema?.[view.primaryDisplay]?.visible !== true) {\n  view.schema[view.primaryDisplay].visible = true\n}","typeGuard":"function displayVisible(view: Omit<ViewV2, \"id\" | \"version\">): boolean {\n  return !view.primaryDisplay || view.schema?.[view.primaryDisplay]?.visible === true\n}","tryCatchPattern":"try {\n  await sdk.views.update(view)\n} catch (e) {\n  if (e instanceof HTTPError && e.status === 400 && e.message.includes(\"because it is the display column\")) {\n    view.schema[view.primaryDisplay].visible = true\n    await sdk.views.update(view)\n  } else { throw e }\n}","preventionTips":["Exclude primaryDisplay from bulk hide operations","Check the table's primary display before generating visibility flags","Re-check display visibility after changing the table's display column"],"tags":["validation","views","schema"],"backgroundTag":"invalid-view-configuration","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}