{"record":{"id":"9393cf0e4c1d85ff","repo":"Budibase/budibase","slug":"no-view-found","errorCode":null,"errorMessage":"No view found","messagePattern":"No view found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/server/src/sdk/workspace/views/external.ts","lineNumber":25,"sourceCode":"import * as utils from \"../../../db/utils\"\nimport { breakExternalTableId } from \"../../../integrations/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\n  const { datasourceId, tableName } = breakExternalTableId(tableId)\n  const ds = await sdk.datasources.get(datasourceId)\n\n  const table = ds.entities![tableName]\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\n  const { datasourceId, tableName } = breakExternalTableId(tableId)\n  const ds = await sdk.datasources.get(datasourceId)\n\n  const table = ds.entities![tableName]\n  const views = Object.values(table.views!).filter(isV2)\n  const found = views.find(v => v.id === viewId)\n  if (!found) {\n    return\n  }","sourceCodeStart":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/server/src/sdk/workspace/views/external.ts#L7-L43","documentation":"sdk.workspace.views.get for external datasources loads the datasource, finds the table, and searches its V2 views for one matching viewId. If no view with that ID exists on that table it throws a plain Error(\"No view found\"). This happens when the view ID is wrong, the view was deleted, or the view belongs to a different table/datasource.","triggerScenarios":"Calling get(viewId) (or anything in its caller chain: components, user, data, integrationList, cachedParams, cachedGoto) with a viewId whose V2 view is not present in ds.entities[tableName].views - e.g. after the view was deleted or the datasource was refreshed and entities were re-fetched.","commonSituations":"Stale client-side references to a deleted view; a typo'd or malformed viewId that parses to the wrong table; saving the datasource changed view IDs; app referencing a view from before a datasource re-sync.","solutions":["Verify the viewId matches an existing V2 view: list the table's views and confirm the id","Re-fetch the datasource/tables (sdk.datasources.get) so the view definitions are current before lookup","Recreate the deleted view or update the caller to use the new view id","Handle the undefined case with getEnriched instead of get if absence is expected"],"exampleFix":"// before\nconst view = await sdk.views.get(viewId)\n// after\ntry {\n  const view = await sdk.views.get(viewId)\n} catch (e) {\n  // view may have been deleted; fall back to listing current views\n  const views = Object.values(table.views ?? {}).filter(isV2)\n}","handlingStrategy":"try-catch","validationCode":"const ds = await sdk.datasources.get(datasourceId)\nconst views = Object.values(ds.entities![tableName]?.views ?? {}).filter(isV2)\nif (!views.some(v => v.id === viewId)) {\n  // view missing - handle before calling get(viewId)\n}","typeGuard":null,"tryCatchPattern":"try {\n  const view = await sdk.views.get(viewId)\n} catch (e) {\n  if (String(e.message) === \"No view found\") {\n    // refresh view list / fall back to table-level data\n  }\n}","preventionTips":["Re-fetch datasource entities before looking up views after any datasource save/sync","Treat view IDs as volatile - re-resolve them rather than persisting long-term","Use getEnriched (returns undefined) when absence is an expected case"],"tags":["not-found","views","external-datasource","lookup"],"backgroundTag":"view-not-found","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}