{"record":{"id":"396f6b730cb39b35","repo":"Budibase/budibase","slug":"tableimporterror-errors","errorCode":null,"errorMessage":"TableImportError(errors)","messagePattern":"TableImportError\\(errors\\)","errorType":"validation","errorClass":"TableImportError","httpStatus":null,"severity":"error","filePath":"packages/builder/src/stores/builder/datasources.ts","lineNumber":172,"sourceCode":"\n  async init() {\n    return this.fetch()\n  }\n\n  select(id: string) {\n    this.store.update(state => ({\n      ...state,\n      selectedDatasourceId: id,\n    }))\n  }\n\n  private updateDatasourceInStore(\n    response: { datasource: Datasource; errors?: Record<string, string> },\n    { ignoreErrors }: { ignoreErrors?: boolean } = {}\n  ) {\n    const { datasource, errors } = response\n    if (!ignoreErrors && errors && Object.keys(errors).length > 0) {\n      throw new TableImportError(errors)\n    }\n    this.replaceDatasource(datasource._id!, datasource)\n    this.select(datasource._id!)\n    return datasource\n  }\n\n  async updateSchema(datasource: Datasource, tablesFilter: string[]) {\n    const response = await API.buildDatasourceSchema(\n      datasource?._id!,\n      tablesFilter\n    )\n    this.updateDatasourceInStore(response)\n  }\n\n  sourceCount(source: string, restTemplateId?: string) {\n    return get(this.store).rawList.filter(\n      datasource =>\n        datasource.source === source &&","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/builder/src/stores/builder/datasources.ts#L154-L190","documentation":"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.","triggerScenarios":"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 }.","commonSituations":"Importing REST/SQL schemas where some tables fail conversion; duplicate or invalid column names; datasource config valid but schema fetch produced partial errors.","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."],"exampleFix":"// before\nawait datasourceStore.save(datasource) // throws TableImportError on partial errors\n// after\ntry {\n  await datasourceStore.save(datasource)\n} catch (e) {\n  if (e instanceof TableImportError) notifyUser(Object.entries(e.errors))\n}","handlingStrategy":"try-catch","validationCode":"// no pre-call validation possible (server-side import errors); inspect response if you control the call\nconst response = await API.updateDatasource(datasource)\nif (response.errors && Object.keys(response.errors).length) {\n  surfaceImportErrors(response.errors) // handle before store update\n}","typeGuard":"const isTableImportError = (e: unknown): e is TableImportError =>\n  e instanceof TableImportError && typeof e.errors === \"object\" && e.errors !== null","tryCatchPattern":"try {\n  await datasourceStore.save(datasource)\n} catch (e) {\n  if (e instanceof TableImportError) {\n    showTableImportErrorsDialog(e.errors)\n    return\n  }\n  throw e\n}","preventionTips":["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."],"tags":["datasources","import","schema","builder"],"backgroundTag":"schema-import-failed","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}