{"record":{"id":"2b23a9e5498f947b","repo":"Budibase/budibase","slug":"view-viewid-not-found","errorCode":null,"errorMessage":"View ${viewId} not found","messagePattern":"View (.+?) not found","errorType":"http","errorClass":"HTTPError","httpStatus":404,"severity":"error","filePath":"packages/server/src/sdk/workspace/views/external.ts","lineNumber":109,"sourceCode":"    throw new HTTPError(`Cannot update view type after creation`, 400)\n  }\n\n  view = ensureQuerySet(view)\n  view = ensureQueryUISet(view)\n\n  delete views[existingView.name]\n  views[view.name] = view\n  await db.put(ds)\n  return { view, existingView } as { view: ViewV2; existingView: ViewV2 }\n}\n\nexport async function remove(viewId: string): Promise<ViewV2> {\n  const db = context.getWorkspaceDB()\n\n  const view = await get(viewId)\n\n  if (!view) {\n    throw new HTTPError(`View ${viewId} not found`, 404)\n  }\n\n  const { datasourceId, tableName } = breakExternalTableId(view.tableId)\n  const ds = await sdk.datasources.get(datasourceId)\n\n  delete ds.entities![tableName].views![view?.name]\n  await db.put(ds)\n  return view\n}\n","sourceCodeStart":91,"sourceCodeEnd":119,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/server/src/sdk/workspace/views/external.ts#L91-L119","documentation":"Thrown by the view V2 remove path when no V2 view exists with the given viewId. It resolves the table id from the view id, reads the view, and 404s if absent before attempting to delete it from the datasource document.","triggerScenarios":"Calling sdk.views.external.remove (or DELETE view API) with a view id that never existed, was already deleted, belongs to a V1 view, or was removed when the datasource doc was rewritten.","commonSituations":"Double-delete from a retrying client; stale UI list after another user deleted the view; wrong id casing/format; app copied without the view.","solutions":["Check existence with sdk.views.get first, or treat 404 as already-deleted success","Refresh the view list before deleting","Verify the view id format (getTableIdFromViewId must parse it)"],"exampleFix":"// before\nawait sdk.views.remove(viewId)\n// after\ntry { await sdk.views.remove(viewId) }\ncatch (e) { if (!(e instanceof HTTPError && e.status === 404)) throw e }","handlingStrategy":"try-catch","validationCode":"const existing = await sdk.views.get(viewId).catch(() => null)\nif (!existing) return // nothing to delete","typeGuard":null,"tryCatchPattern":"try { await sdk.views.remove(viewId) }\ncatch (e) {\n  if (e instanceof HTTPError && e.status === 404) return // idempotent delete\n  throw e\n}","preventionTips":["Make deletes idempotent by treating 404 as success","Refresh view lists before issuing deletes","Avoid concurrent delete jobs for the same view","Validate view id format before calling"],"tags":["http-404","views","external-datasource"],"backgroundTag":"view-not-found","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}