{"record":{"id":"82503a2a3c5e954d","repo":"Budibase/budibase","slug":"unable-to-map-type-column-type-to-sqlite-type","errorCode":null,"errorMessage":"Unable to map type \"${column.type}\" to SQLite type","messagePattern":"Unable to map type \"(.+?)\" to SQLite type","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/server/src/sdk/workspace/tables/internal/sqs.ts","lineNumber":95,"sourceCode":"\n// this can generate relationship tables as part of the mapping\nfunction mapTable(table: Table): SQLiteTables {\n  const tables: SQLiteTables = {}\n  const fields: Record<string, { field: string; type: SQLiteType }> = {}\n  // a list to make sure no duplicates - the fields are mapped by SQS with case sensitivity\n  // but need to make sure there are no duplicate columns\n  const usedColumns: string[] = []\n  for (let [key, column] of Object.entries(table.schema)) {\n    // relationships should be handled differently\n    if (column.type === FieldType.LINK) {\n      const { tableId, definition } = buildRelationshipDefinitions(\n        table,\n        column\n      )\n      tables[tableId] = { fields: definition }\n    }\n    if (!FieldTypeMap[column.type]) {\n      throw new Error(`Unable to map type \"${column.type}\" to SQLite type`)\n    }\n    const lcKey = key.toLowerCase()\n    // ignore duplicates\n    if (usedColumns.includes(lcKey)) {\n      continue\n    }\n    usedColumns.push(lcKey)\n    fields[mapToUserColumn(key)] = {\n      field: key,\n      type: FieldTypeMap[column.type],\n    }\n  }\n  // there are some extra columns to map - add these in\n  const constantMap: Record<string, SQLiteType> = {}\n  PROTECTED_INTERNAL_COLUMNS.forEach(col => {\n    constantMap[col] = SQLiteType.TEXT\n  })\n  const thisTable: SQLiteTable = {","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/server/src/sdk/workspace/tables/internal/sqs.ts#L77-L113","documentation":"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.","triggerScenarios":"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.","commonSituations":"Version skew where a newer app wrote a column type the running server doesn't know; hand-edited table documents; plugin-provided field types.","solutions":["Add the missing type to FieldTypeMap in packages/server/src/sdk/workspace/tables/internal/sqs.ts","Fix the column type in the table document to a supported FieldType","Restore/repair the corrupted schema column (or delete the bad column)","Align server version with the version that created the table"],"exampleFix":"// before (sqs.ts FieldTypeMap)\n{ [FieldType.STRING]: 'text' }\n// after\n{ [FieldType.STRING]: 'text', [FieldType.BARCODE]: 'text' }","handlingStrategy":"validation","validationCode":"import { FieldTypeMap } from '.../internal/sqs'\nfunction allTypesMappable(table: Table): boolean {\n  return Object.values(table.schema).every(col => !!FieldTypeMap[col.type])\n}","typeGuard":"function isMappableType(type: FieldType): boolean {\n  return type in FieldTypeMap\n}","tryCatchPattern":"try {\n  const def = await getTable(tableId) // triggers mapTable\n} catch (e) {\n  if (e.message.includes('to SQLite type')) {\n    // fix the offending column type or patch FieldTypeMap\n  }\n}","preventionTips":["When adding a new FieldType, add a FieldTypeMap entry in sqs.ts in the same change","Keep server and app versions aligned","Validate table documents after restores/imports","Remove or repair corrupted schema entries"],"tags":["sqlite","schema","type-mapping"],"backgroundTag":"unsupported-column-type","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}