{"record":{"id":"465b502c1fc68924","repo":"influxdata/influxdb","slug":"invalid-column-type-for-column-column-name-expected-expected","errorCode":null,"errorMessage":"invalid column type for column '{column_name}', expected {expected}, got {got}","messagePattern":"invalid column type for column '(.+?)', expected (.+?), got (.+?)","errorType":"validation","errorClass":"CatalogError","httpStatus":400,"severity":"error","filePath":"influxdb3_catalog/src/error.rs","lineNumber":90,"sourceCode":"        live_sequence: u64,\n    },\n\n    #[error(\"invalid configuration provided: {message}\")]\n    InvalidConfiguration { message: Box<str> },\n\n    #[error(\"only tag and string columns are supported in the distinct cache\")]\n    InvalidDistinctCacheColumnType,\n\n    #[error(\"only uint64, int64, bool, tag, and string columns are supported in the last cache\")]\n    InvalidLastCacheKeyColumnType,\n\n    #[error(\"plugin trigger is already enabled\")]\n    TriggerAlreadyEnabled,\n\n    #[error(\"plugin trigger is already disabled\")]\n    TriggerAlreadyDisabled,\n\n    #[error(\"invalid column type for column '{column_name}', expected {expected}, got {got}\")]\n    InvalidColumnType {\n        column_name: Arc<str>,\n        expected: InfluxColumnType,\n        got: InfluxColumnType,\n    },\n\n    #[error(\"'{0}' is a reserved column\")]\n    ReservedColumn(Arc<str>),\n\n    #[error(\n        \"table '{table_name}' is not defined in database '{db_name}', which uses explicit schemas; \\\n         create the table with the /api/v3/configure/table API before writing to it\"\n    )]\n    UndeclaredTable {\n        db_name: Arc<str>,\n        table_name: Arc<str>,\n    },\n","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/influxdb3_catalog/src/error.rs#L72-L108","documentation":"CatalogError::InvalidColumnType is thrown when a column's type does not match what the operation expects — e.g. altering a table or writing against a column whose actual InfluxColumnType differs from the declared/expected one. The error carries the column name plus both the expected and got types so the mismatch is diagnosable.","triggerScenarios":"Adding a column to a table definition where a column of the same name already exists with a different type; write requests whose field/tag type for a named column disagrees with the table schema; schema-alter operations supplying an incompatible InfluxColumnType.","commonSituations":"Writers sending a field as an integer while the schema defines it as float; renaming/refactoring that reuses an existing column name with a new type; replaying old line-protocol data after a schema change.","solutions":["Inspect the table schema and change the incoming write/operation to use the existing column type.","Use a differently named column for the new type instead of conflicting with the existing one.","If the schema itself is wrong, migrate the table: create a new column of the correct type, backfill, and drop the old one."],"exampleFix":"// before\nline: 'cpu temp=72i'  // temp is float in schema -> InvalidColumnType\n// after\nline: 'cpu temp=72.0'","handlingStrategy":"validation","validationCode":"async function assertColumnType(db, table, col, expectedType) {\n  const schema = await getTableSchema(db, table);\n  const actual = schema.columns.find(c => c.name === col)?.type;\n  if (actual !== expectedType) throw new Error(`${col} is ${actual}, expected ${expectedType}`);\n}","typeGuard":"const columnMatches = (schema, name, type) =>\n  schema.columns.some(c => c.name === name && c.type === type);","tryCatchPattern":"try {\n  await writePoint(point);\n} catch (e) {\n  if (e.message.includes(\"invalid column type\")) {\n    await alignWriterSchemaWithCatalog(); // resync writer to catalog types\n  } else { throw e; }\n}","preventionTips":["Generate writer payloads from the catalog schema, not hardcoded literals.","Use explicit numeric literals (72.0 vs 72i) matching declared types.","Pin a shared schema definition consumed by both migrations and writers."],"tags":["influxdb3","schema","type-mismatch","column"],"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"}