Budibase/budibase · error

No view found

Error message

No view found

What it means

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.

Source

Thrown at packages/server/src/sdk/workspace/views/internal.ts:20

import { ViewV2, ViewV2Enriched } from "@budibase/types"

import { getTableIdFromViewId } from "@budibase/shared-core"
import { enrichSchema, isV2 } from "."
import sdk from "../.."
import * as utils from "../../../db/utils"
import {
  ensureQuerySet,
  ensureQueryUISet,
  ensureValidPrimaryDisplay,
} from "./utils"

export async function get(viewId: string): Promise<ViewV2> {
  const tableId = getTableIdFromViewId(viewId)
  const table = await sdk.tables.getTable(tableId)
  const views = Object.values(table.views!).filter(isV2)
  const found = views.find(v => v.id === viewId)
  if (!found) {
    throw new Error("No view found")
  }
  return ensureQueryUISet(found)
}

export async function getEnriched(
  viewId: string
): Promise<ViewV2Enriched | undefined> {
  const tableId = getTableIdFromViewId(viewId)
  const table = await sdk.tables.getTable(tableId)
  const views = Object.values(table.views!).filter(isV2)
  const found = views.find(v => v.id === viewId)
  if (!found) {
    return
  }
  return await enrichSchema(
    ensureValidPrimaryDisplay(ensureQueryUISet(found), table),
    table.schema
  )

View on GitHub (pinned to a81a902e9a)

Solutions

  1. Verify the viewId exists via sdk.tables.getTable(tableId) and inspect table.views.
  2. Recreate the view if it was deleted and re-fetch its id.
  3. If the view is a legacy V1 view, use the appropriate legacy API instead of the V2 sdk.views.get.
  4. Fix the tableId encoded in the viewId (views are scoped to their table).

Example fix

// before
const view = await sdk.views.get("unknown_view_id")
// after
const table = await sdk.tables.getTable(tableId)
const viewId = Object.values(table.views ?? {}).find(v => v.name === "myView")?.id
if (!viewId) throw new Error("view not configured")
const view = await sdk.views.get(viewId)
Defensive patterns

Strategy: try-catch

Validate before calling

const table = await sdk.tables.getTable(getTableIdFromViewId(viewId))
const exists = Object.values(table.views ?? {}).some(v => isV2(v) && v.id === viewId)
if (!exists) return null // skip get

Type guard

function isV2View(v: unknown): v is ViewV2 {
  return typeof v === "object" && v !== null && "id" in v && "version" in v
}

Try / catch

let view
try {
  view = await sdk.views.get(viewId)
} catch (e) {
  if (e instanceof Error && e.message === "No view found") {
    view = null
  } else { throw e }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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