Budibase/budibase · error · Error

Unable to find table named "${tableName}"

Error message

Unable to find table named "${tableName}"

What it means

getExternalTable fetches a specific table by name from a datasource's fetched entities. If the datasource has no entity with that exact name, it throws with the requested tableName. This is a lookup failure against the live datasource metadata.

Source

Thrown at packages/server/src/sdk/workspace/tables/getters.ts:209

    }

    // filter out sample data here. i.e the sample ta_bb_employees gets included otherweise
    final = final.filter(table => table._id && isExternalTableID(table._id))

    span.addTags({ numTables: final.length })
    return await processTables(final)
  })
}

export async function getExternalTable(
  datasourceId: string,
  tableName: string
): Promise<Table> {
  return await tracer.trace("getExternalTable", async span => {
    span.addTags({ datasourceId, tableName })
    const entities = await getExternalTablesInDatasource(datasourceId)
    if (!entities[tableName]) {
      throw new Error(`Unable to find table named "${tableName}"`)
    }
    const table = await processTable(entities[tableName])
    if (!table.sourceId) {
      table.sourceId = datasourceId
    }
    return table
  })
}

export async function getTable(tableId: string): Promise<Table> {
  return await tracer.trace("getTable", async span => {
    const db = context.getWorkspaceDB()
    span.addTags({ tableId, db: db.name })
    let output: Table
    if (tableId && isExternalTableID(tableId)) {
      let { datasourceId, tableName } = breakExternalTableId(tableId)
      span.addTags({ isExternal: true, datasourceId, tableName })
      const datasource = await datasources.get(datasourceId)

View on GitHub (pinned to a81a902e9a)

Solutions

  1. Verify the exact table name in the source database and re-request with the correct name
  2. Refresh/sync the datasource entities so new tables are detected
  3. Check case sensitivity (Postgres identifiers are lowercase unless quoted)
  4. List available tables via getExternalTablesInDatasource(datasourceId) to find the right key

Example fix

// before
await tables.external.get(datasourceId, "Users") // table is actually "users"
// after
const entities = await tables.external.getExternalTablesInDatasource(datasourceId)
await tables.external.get(datasourceId, Object.keys(entities).find(n => n.toLowerCase() === "users"))
Defensive patterns

Strategy: validation

Validate before calling

const entities = await tables.external.getExternalTablesInDatasource(datasourceId)
if (!entities[tableName]) throw new Error(`Unknown table: ${tableName}`)

Type guard

function tableExists(entities: Record<string, Table>, name: string): boolean {
  return Object.prototype.hasOwnProperty.call(entities, name)
}

Try / catch

try {
  const t = await tables.external.get(datasourceId, tableName)
} catch (err) {
  if (err.message.startsWith("Unable to find table named")) {
    // refresh datasource entities or correct the table name
  }
}

Prevention

When it happens

Trigger: Calling getExternalTable(datasourceId, tableName) (or tables.getExternalTable / get with a table name) where entities[tableName] is undefined — wrong name, table dropped, or case mismatch.

Common situations: Table renamed or dropped in the SQL database after last sync; case-sensitivity mismatch (Postgres lowercase vs quoted names); stale datasource entities cache; typo in table name.

Related errors


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