Budibase/budibase · error · Error

Unable to map type " " to SQLite type

Error message

Unable to map type "${column.type}" to SQLite type

What it means

mapTable in the internal-tables SQLite (SQS) layer converts each Budibase column type to a SQLite column type via FieldTypeMap; if a column's type has no mapping, the schema cannot be represented in SQLite and this error is thrown. Called from buildBaseDefinition and addTable.

Solutions

  1. Add the missing type to FieldTypeMap in packages/server/src/sdk/workspace/tables/internal/sqs.ts
  2. Fix the column type in the table document to a supported FieldType
  3. Restore/repair the corrupted schema column (or delete the bad column)
  4. Align server version with the version that created the table

Example fix

// before (sqs.ts FieldTypeMap)
{ [FieldType.STRING]: 'text' }
// after
{ [FieldType.STRING]: 'text', [FieldType.BARCODE]: 'text' }
Defensive patterns

Strategy: validation

Validate before calling

import { FieldTypeMap } from '.../internal/sqs'
function allTypesMappable(table: Table): boolean {
  return Object.values(table.schema).every(col => !!FieldTypeMap[col.type])
}

Type guard

function isMappableType(type: FieldType): boolean {
  return type in FieldTypeMap
}

Try / catch

try {
  const def = await getTable(tableId) // triggers mapTable
} catch (e) {
  if (e.message.includes('to SQLite type')) {
    // fix the offending column type or patch FieldTypeMap
  }
}

Prevention

When it happens

Trigger: Fetching/reading an internal table whose schema contains a column type missing from FieldTypeMap — e.g. a new/experimental FieldType added in types but not yet mapped in sqs.ts, or a corrupted schema with an undefined type.

Common situations: Version skew where a newer app wrote a column type the running server doesn't know; hand-edited table documents; plugin-provided field types.

Related errors


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

Appendix: source

Thrown at packages/server/src/sdk/workspace/tables/internal/sqs.ts:95

// this can generate relationship tables as part of the mapping
function mapTable(table: Table): SQLiteTables {
  const tables: SQLiteTables = {}
  const fields: Record<string, { field: string; type: SQLiteType }> = {}
  // a list to make sure no duplicates - the fields are mapped by SQS with case sensitivity
  // but need to make sure there are no duplicate columns
  const usedColumns: string[] = []
  for (let [key, column] of Object.entries(table.schema)) {
    // relationships should be handled differently
    if (column.type === FieldType.LINK) {
      const { tableId, definition } = buildRelationshipDefinitions(
        table,
        column
      )
      tables[tableId] = { fields: definition }
    }
    if (!FieldTypeMap[column.type]) {
      throw new Error(`Unable to map type "${column.type}" to SQLite type`)
    }
    const lcKey = key.toLowerCase()
    // ignore duplicates
    if (usedColumns.includes(lcKey)) {
      continue
    }
    usedColumns.push(lcKey)
    fields[mapToUserColumn(key)] = {
      field: key,
      type: FieldTypeMap[column.type],
    }
  }
  // there are some extra columns to map - add these in
  const constantMap: Record<string, SQLiteType> = {}
  PROTECTED_INTERNAL_COLUMNS.forEach(col => {
    constantMap[col] = SQLiteType.TEXT
  })
  const thisTable: SQLiteTable = {

View on GitHub (pinned to a81a902e9a)