{"record":{"id":"0b606fe6ee673803","repo":"Budibase/budibase","slug":"unable-to-retrieve-view-table","errorCode":null,"errorMessage":"Unable to retrieve view table.","messagePattern":"Unable to retrieve view table\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/server/src/sdk/workspace/rows/search/internal/internal.ts","lineNumber":227,"sourceCode":"  } else {\n    const tableId = viewInfo.meta!.tableId\n    const data = await fetchRaw(tableId!)\n    response = await inMemoryViews.runView(\n      viewInfo,\n      calculation as string,\n      !!group,\n      data\n    )\n  }\n\n  let rows: Row[] = []\n  if (!calculation) {\n    response.rows = response.rows.map(row => row.doc)\n    let table: Table\n    try {\n      table = await sdk.tables.getTable(viewInfo.meta!.tableId)\n    } catch (err) {\n      throw new Error(\"Unable to retrieve view table.\")\n    }\n    rows = await outputProcessing(table, response.rows)\n  }\n\n  if (calculation === CALCULATION_TYPES.STATS) {\n    response.rows = response.rows.map(row => ({\n      group: row.key,\n      field,\n      ...row.value,\n      avg: row.value.sum / row.value.count,\n    }))\n    rows = response.rows\n  }\n\n  if (\n    calculation === CALCULATION_TYPES.COUNT ||\n    calculation === CALCULATION_TYPES.SUM\n  ) {","sourceCodeStart":209,"sourceCodeEnd":245,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/server/src/sdk/workspace/rows/search/internal/internal.ts#L209-L245","documentation":"fetchLegacyView reads rows from a legacy view, then needs the view's parent table to run outputProcessing. If getting that table throws for any reason, the original error is replaced with this generic message (the cause is swallowed).","triggerScenarios":"Querying a legacy (non-calculation) view whose meta.tableId points to a deleted, renamed, or inaccessible table.","commonSituations":"Table deleted while views remained; app copied/restored without the table doc; permission or replication issues making the table doc unreadable.","solutions":["Check the view's meta.tableId and confirm that table still exists","Recreate the missing table or delete/rebuild the stale view","Inspect the underlying error (the original cause is lost, so log before this throw if debugging)","Re-save the view so its meta is regenerated from an existing table"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const view = await sdk.views.get(viewId)\nawait sdk.tables.getTable(view.meta.tableId) // throws early if table missing","typeGuard":"function hasValidViewMeta(v: View | undefined): v is View & { meta: { tableId: string } } { return !!v && !!v.meta && typeof v.meta.tableId === 'string' }","tryCatchPattern":"try { rows = await fetchLegacyView(...) } catch (e) { if (e.message.includes('Unable to retrieve view table')) { /* rebuild view or restore table */ } else throw e }","preventionTips":["Delete views when their source table is deleted","Validate view meta.tableId resolves before querying","Rebuild legacy views after app restores/copies"],"tags":["views","legacy-views","missing-table"],"backgroundTag":"referenced-resource-missing","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}