{"record":{"id":"2b057f7d2713a3e0","repo":"influxdata/influxdb","slug":"field-type-mismatch-on-table-table-name-column-column-name","errorCode":null,"errorMessage":"Field type mismatch on table {table_name} column {column_name}. Existing column is {existing} but attempted to add {attempted}","messagePattern":"Field type mismatch on table (.+?) column (.+?)\\. Existing column is (.+?) but attempted to add (.+?)","errorType":"validation","errorClass":"CatalogError","httpStatus":400,"severity":"error","filePath":"influxdb3_catalog/src/error.rs","lineNumber":183,"sourceCode":"\n    #[error(\n        \"table '{table_name}' in storage mode {storage_mode:?} cannot allocate more legacy column IDs\"\n    )]\n    LegacyColumnIdsExhausted {\n        table_name: Arc<str>,\n        storage_mode: StorageMode,\n    },\n\n    #[error(\"Database not found {}\", db_name)]\n    DatabaseNotFound { db_name: Arc<str> },\n\n    #[error(\"Table {} not in DB schema for {}\", table_name, db_name)]\n    TableNotFound {\n        db_name: Arc<str>,\n        table_name: Arc<str>,\n    },\n\n    #[error(\n        \"Field type mismatch on table {} column {}. Existing column is {} but attempted to add {}\",\n        table_name,\n        column_name,\n        existing,\n        attempted\n    )]\n    FieldTypeMismatch {\n        table_name: String,\n        column_name: String,\n        existing: InfluxColumnType,\n        attempted: InfluxColumnType,\n    },\n\n    #[error(\n        \"Series key mismatch on table {}. Existing table has {}\",\n        table_name,\n        existing\n    )]","sourceCodeStart":165,"sourceCodeEnd":201,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/influxdb3_catalog/src/error.rs#L165-L201","documentation":"Thrown when a write or schema update tries to add a column (`column_name`) with a data type that differs from the type already stored for that column on the table. InfluxDB 3 columns have a fixed type once created; the error reports the existing type and the attempted type so the conflict is explicit.","triggerScenarios":"Writing a field whose value type differs from the column's established type — e.g. writing `temp=\"72\"` (string) after the column was created as float; sending integer then float for the same field; producer code changes that alter serialization.","commonSituations":"Application upgrade changing a metric from integer to float (or vice versa); JSON payloads where values sometimes serialize as string; line protocol with a quoted number; multiple producers with inconsistent types for the same field name.","solutions":["Cast the incoming value to the existing column type in the producer (e.g. write 72.0 for a float column)","Use a new column (or table) for the different type and migrate/backfill historical data","Normalize producer serialization so field types are stable (explicit schema/contract)","If the type genuinely must change, drop and recreate the table (data loss) or migrate to a new table"],"exampleFix":"// before: string where float exists\ntemp,room=1 value=\"72.5\"\n// after: match existing float column\ntemp,room=1 value=72.5","handlingStrategy":"validation","validationCode":"const col = schema.columns[columnName];\nif (col && typeof value !== col.jsType) {\n  value = coerce(value, col.type); // e.g. parseFloat(value) for float columns\n}","typeGuard":"function matchesColumnType(value: unknown, existing: ColumnType): boolean {\n  switch (existing) {\n    case 'float': return typeof value === 'number';\n    case 'integer': return Number.isInteger(value);\n    case 'string': return typeof value === 'string';\n    case 'boolean': return typeof value === 'boolean';\n  }\n}","tryCatchPattern":"try {\n  await write(points);\n} catch (e) {\n  if (/Field type mismatch/.test(String(e.message))) {\n    // coerce types per the reported existing type and rewrite\n  } throw e;\n}","preventionTips":["Serialize numbers explicitly in producers (never stringify metrics)","Pin field types in a schema contract and validate payloads before writing","When changing a metric's unit/precision, write to a new column, not the same name","Add integration tests that write representative points against a real schema"],"tags":["schema","type-mismatch","field","catalog"],"backgroundTag":"type-mismatch","analyzedSha":"06200ef96ba82c5f6727e5038a83af8e722c6875","analyzedAt":"2026-09-19T12:55:30.003Z","contentChangedAt":"2026-09-19T12:55:30.003Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}