Budibase/budibase · error · Error

Unable to retrieve view table.

Error message

Unable to retrieve view table.

What it means

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).

Source

Thrown at packages/server/src/sdk/workspace/rows/search/internal/internal.ts:227

  } else {
    const tableId = viewInfo.meta!.tableId
    const data = await fetchRaw(tableId!)
    response = await inMemoryViews.runView(
      viewInfo,
      calculation as string,
      !!group,
      data
    )
  }

  let rows: Row[] = []
  if (!calculation) {
    response.rows = response.rows.map(row => row.doc)
    let table: Table
    try {
      table = await sdk.tables.getTable(viewInfo.meta!.tableId)
    } catch (err) {
      throw new Error("Unable to retrieve view table.")
    }
    rows = await outputProcessing(table, response.rows)
  }

  if (calculation === CALCULATION_TYPES.STATS) {
    response.rows = response.rows.map(row => ({
      group: row.key,
      field,
      ...row.value,
      avg: row.value.sum / row.value.count,
    }))
    rows = response.rows
  }

  if (
    calculation === CALCULATION_TYPES.COUNT ||
    calculation === CALCULATION_TYPES.SUM
  ) {

View on GitHub (pinned to a81a902e9a)

Solutions

  1. Check the view's meta.tableId and confirm that table still exists
  2. Recreate the missing table or delete/rebuild the stale view
  3. Inspect the underlying error (the original cause is lost, so log before this throw if debugging)
  4. Re-save the view so its meta is regenerated from an existing table
Defensive patterns

Strategy: try-catch

Validate before calling

const view = await sdk.views.get(viewId)
await sdk.tables.getTable(view.meta.tableId) // throws early if table missing

Type guard

function hasValidViewMeta(v: View | undefined): v is View & { meta: { tableId: string } } { return !!v && !!v.meta && typeof v.meta.tableId === 'string' }

Try / catch

try { rows = await fetchLegacyView(...) } catch (e) { if (e.message.includes('Unable to retrieve view table')) { /* rebuild view or restore table */ } else throw e }

Prevention

When it happens

Trigger: Querying a legacy (non-calculation) view whose meta.tableId points to a deleted, renamed, or inaccessible table.

Common situations: Table deleted while views remained; app copied/restored without the table doc; permission or replication issues making the table doc unreadable.

Related errors


AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29). Data as JSON: /api/errors/0b606fe6ee673803. Report an issue: GitHub.