Budibase/budibase · error · TableImportError
TableImportError(errors)
Error message
TableImportError(errors)
What it means
updateDatasourceInStore applies a datasource save/update API response to the builder store. If the response carries a non-empty errors map (schema/table import errors returned by the server) and ignoreErrors was not set, it throws TableImportError(errors) so callers can surface per-table/per-field import problems instead of silently storing a partially imported datasource.
Source
Thrown at packages/builder/src/stores/builder/datasources.ts:172
async init() {
return this.fetch()
}
select(id: string) {
this.store.update(state => ({
...state,
selectedDatasourceId: id,
}))
}
private updateDatasourceInStore(
response: { datasource: Datasource; errors?: Record<string, string> },
{ ignoreErrors }: { ignoreErrors?: boolean } = {}
) {
const { datasource, errors } = response
if (!ignoreErrors && errors && Object.keys(errors).length > 0) {
throw new TableImportError(errors)
}
this.replaceDatasource(datasource._id!, datasource)
this.select(datasource._id!)
return datasource
}
async updateSchema(datasource: Datasource, tablesFilter: string[]) {
const response = await API.buildDatasourceSchema(
datasource?._id!,
tablesFilter
)
this.updateDatasourceInStore(response)
}
sourceCount(source: string, restTemplateId?: string) {
return get(this.store).rawList.filter(
datasource =>
datasource.source === source &&View on GitHub (pinned to a81a902e9a)
Solutions
- Inspect the TableImportError.errors map and fix the offending tables/columns in the source, then retry.
- Pass { ignoreErrors: true } to updateDatasourceInStore (where the API allows) to accept the datasource with partial errors.
- Adjust the import (skip problematic tables or correct types) and re-run the schema fetch.
Example fix
// before
await datasourceStore.save(datasource) // throws TableImportError on partial errors
// after
try {
await datasourceStore.save(datasource)
} catch (e) {
if (e instanceof TableImportError) notifyUser(Object.entries(e.errors))
} Defensive patterns
Strategy: try-catch
Validate before calling
// no pre-call validation possible (server-side import errors); inspect response if you control the call
const response = await API.updateDatasource(datasource)
if (response.errors && Object.keys(response.errors).length) {
surfaceImportErrors(response.errors) // handle before store update
} Type guard
const isTableImportError = (e: unknown): e is TableImportError => e instanceof TableImportError && typeof e.errors === "object" && e.errors !== null
Try / catch
try {
await datasourceStore.save(datasource)
} catch (e) {
if (e instanceof TableImportError) {
showTableImportErrorsDialog(e.errors)
return
}
throw e
} Prevention
- Always wrap create/updateSchema calls in try/catch for TableImportError.
- Show the per-table errors map to users instead of a generic failure message.
- Pre-validate column names/types where possible before triggering schema imports.
When it happens
Trigger: Calling datasources.updateSchema, create, or save (updatedDatasource) where the server response contains errors — e.g. table import returned field-level errors (bad types, unsupported columns) — and the call did not pass { ignoreErrors: true }.
Common situations: Importing REST/SQL schemas where some tables fail conversion; duplicate or invalid column names; datasource config valid but schema fetch produced partial errors.
Related errors
- Unable to determine delimiter
- Cannot render an empty flow chain
- Source table '${relationship.sourceTable}' not found in data
- Target table '${relationship.targetTable}' not found in data
- Junction table not specified for many-to-many relationship b
AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29).
Data as JSON: /api/errors/396f6b730cb39b35.
Report an issue: GitHub.