{"record":{"id":"2b88332f1c93a65c","repo":"Budibase/budibase","slug":"no-view-found-2b8833","errorCode":null,"errorMessage":"No view found","messagePattern":"No view found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/server/src/sdk/workspace/views/internal.ts","lineNumber":20,"sourceCode":"import { ViewV2, ViewV2Enriched } from \"@budibase/types\"\n\nimport { getTableIdFromViewId } from \"@budibase/shared-core\"\nimport { enrichSchema, isV2 } from \".\"\nimport sdk from \"../..\"\nimport * as utils from \"../../../db/utils\"\nimport {\n  ensureQuerySet,\n  ensureQueryUISet,\n  ensureValidPrimaryDisplay,\n} from \"./utils\"\n\nexport async function get(viewId: string): Promise<ViewV2> {\n  const tableId = getTableIdFromViewId(viewId)\n  const table = await sdk.tables.getTable(tableId)\n  const views = Object.values(table.views!).filter(isV2)\n  const found = views.find(v => v.id === viewId)\n  if (!found) {\n    throw new Error(\"No view found\")\n  }\n  return ensureQueryUISet(found)\n}\n\nexport async function getEnriched(\n  viewId: string\n): Promise<ViewV2Enriched | undefined> {\n  const tableId = getTableIdFromViewId(viewId)\n  const table = await sdk.tables.getTable(tableId)\n  const views = Object.values(table.views!).filter(isV2)\n  const found = views.find(v => v.id === viewId)\n  if (!found) {\n    return\n  }\n  return await enrichSchema(\n    ensureValidPrimaryDisplay(ensureQueryUISet(found), table),\n    table.schema\n  )","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/server/src/sdk/workspace/views/internal.ts#L2-L38","documentation":"sdk.views.get resolves a viewId to its parent table, filters the table's views to V2 views, and finds the matching id. If none matches, a plain Error('No view found') is thrown — the view doesn't exist or isn't a V2 view on that table.","triggerScenarios":"Calling sdk.views.get(viewId) with an id belonging to a deleted view, a V1 view (filtered out by isV2), a view in a different table, or a malformed id whose embedded tableId points to the wrong table.","commonSituations":"Stale view ids cached in client code after view deletion; fetching legacy V1 views via the V2 SDK; typos in view ids; app copied without the view.","solutions":["Verify the viewId exists via sdk.tables.getTable(tableId) and inspect table.views.","Recreate the view if it was deleted and re-fetch its id.","If the view is a legacy V1 view, use the appropriate legacy API instead of the V2 sdk.views.get.","Fix the tableId encoded in the viewId (views are scoped to their table)."],"exampleFix":"// before\nconst view = await sdk.views.get(\"unknown_view_id\")\n// after\nconst table = await sdk.tables.getTable(tableId)\nconst viewId = Object.values(table.views ?? {}).find(v => v.name === \"myView\")?.id\nif (!viewId) throw new Error(\"view not configured\")\nconst view = await sdk.views.get(viewId)","handlingStrategy":"try-catch","validationCode":"const table = await sdk.tables.getTable(getTableIdFromViewId(viewId))\nconst exists = Object.values(table.views ?? {}).some(v => isV2(v) && v.id === viewId)\nif (!exists) return null // skip get","typeGuard":"function isV2View(v: unknown): v is ViewV2 {\n  return typeof v === \"object\" && v !== null && \"id\" in v && \"version\" in v\n}","tryCatchPattern":"let view\ntry {\n  view = await sdk.views.get(viewId)\n} catch (e) {\n  if (e instanceof Error && e.message === \"No view found\") {\n    view = null\n  } else { throw e }\n}","preventionTips":["Refresh cached view ids after view deletion","Confirm views are V2 (isV2) before using the V2 SDK","Derive view ids from the table's views map rather than hardcoding"],"tags":["not-found","views"],"backgroundTag":"resource-not-found","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}