{"record":{"id":"779814470f87aecc","repo":"Budibase/budibase","slug":"you-can-t-hide-field-name-because-it-is-a-req","errorCode":null,"errorMessage":"You can't hide \"${field.name}\" because it is a required field.","messagePattern":"You can't hide \"(.+?)\" because it is a required field\\.","errorType":"validation","errorClass":"HTTPError","httpStatus":400,"severity":"error","filePath":"packages/server/src/sdk/workspace/views/index.ts","lineNumber":308,"sourceCode":"function 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]\n    const existingViewSchema = existingView?.schema?.[field.name]\n    if (!viewSchemaField && !existingViewSchema?.visible) {\n      // Supporting existing configs with required columns but hidden in views\n      continue\n    }\n\n    if (!viewSchemaField?.visible) {\n      throw new HTTPError(\n        `You can't hide \"${field.name}\" because it is a required field.`,\n        400\n      )\n    }\n\n    if (\n      helpers.views.isBasicViewField(viewSchemaField) &&\n      viewSchemaField.readonly\n    ) {\n      throw new HTTPError(\n        `You can't make \"${field.name}\" readonly because it is a required field.`,\n        400\n      )\n    }\n  }\n}\n\nexport async function create(","sourceCodeStart":290,"sourceCodeEnd":326,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/server/src/sdk/workspace/views/index.ts#L290-L326","documentation":"checkRequiredFields walks table fields with constraints (required) and refuses to let a view hide them: if the field exists in the view schema with visible falsy, a 400 HTTPError is thrown. Required columns must stay visible so users can supply their values.","triggerScenarios":"create/update via guardViewSchema where a required table field maps to viewSchema[field] with visible !== true (and the field isn't in the legacy hidden-but-required escape hatch branch).","commonSituations":"Hiding required columns in the builder; bulk visibility toggles; view JSON edited by hand or migrated between apps where required flags changed.","solutions":["Set visible: true for the required field in the view schema.","Remove the required constraint from the table field if hiding it is genuinely needed.","Remove the field from the view schema only if the legacy continue branch applies (field absent and not previously visible) — otherwise this won't bypass the check."],"exampleFix":"// before\nview.schema[\"title\"].visible = false // title is required in table\n// after\nview.schema[\"title\"].visible = true","handlingStrategy":"validation","validationCode":"for (const f of Object.keys(table.schema)) {\n  if (table.schema[f].constraints?.required && view.schema?.[f] && view.schema[f].visible !== true) {\n    view.schema[f].visible = true\n  }\n}","typeGuard":"function requiredFieldsVisible(view: ViewV2, table: Table): boolean {\n  return Object.entries(table.schema).every(([name, f]) =>\n    !(f.constraints?.required && view.schema?.[name] && view.schema[name].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 a required field\")) {\n    // make the field visible or drop the required constraint, then retry\n  } else { throw e }\n}","preventionTips":["Fetch the table schema and check constraints.required before setting visibility","Never bulk-hide columns without checking required flags","Re-validate views after changing column required constraints"],"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"}