{"record":{"id":"469dc6f4ffdffc89","repo":"influxdata/influxdb","slug":"column-type-mismatch-for-column-name-existing-existing-new","errorCode":null,"errorMessage":"column type mismatch for column {name}: existing: {existing:?}, new: {new:?}","messagePattern":"column type mismatch for column (.+?): existing: (.+?), new: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"influxdb3_write/src/write_buffer/mod.rs","lineNumber":76,"sourceCode":"use queryable_buffer::QueryableBufferArgs;\nuse schema::Schema;\nuse std::{\n    borrow::Borrow,\n    num::{NonZeroU64, NonZeroUsize},\n    sync::Arc,\n    time::Duration,\n};\nuse thiserror::Error;\n\n#[derive(Debug, Error)]\npub enum Error {\n    #[error(\"line protocol parse failed: {}\", .0.error_message)]\n    ParseError(WriteLineError),\n\n    #[error(\"incoming write was empty\")]\n    EmptyWrite,\n\n    #[error(\"column type mismatch for column {name}: existing: {existing:?}, new: {new:?}\")]\n    ColumnTypeMismatch {\n        name: String,\n        existing: ColumnType,\n        new: ColumnType,\n    },\n\n    #[error(\"catalog update error: {0}\")]\n    CatalogUpdateError(#[from] CatalogError),\n\n    #[error(\"error from persister: {0}\")]\n    PersisterError(#[from] PersisterError),\n\n    #[error(\"corrupt load state: {0}\")]\n    CorruptLoadState(String),\n\n    #[error(\"database name error: {0}\")]\n    DatabaseNameError(#[from] DatabaseNameError),\n","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/influxdb3_write/src/write_buffer/mod.rs#L58-L94","documentation":"write_buffer::Error::ColumnTypeMismatch reports that a write attempted to add a value whose type differs from the column's existing type in the table (e.g. writing a string to a previously float column). The error names the column plus the existing and new ColumnType. InfluxDB 3 enforces consistent column types per table, so the write is rejected.","triggerScenarios":"Writing line protocol or points to an existing table where a field/tag name already exists with a different type — e.g. field 'value' stored as Float, new batch sends value=42i (Integer) or value=\"x\" (String).","commonSituations":"Schema drift after a sensor/agent upgrade that changed a field from float to integer; clients mixing JSON number and string serialization for the same field; two applications using the same measurement with different type conventions; booleans vs strings ('true' vs true).","solutions":["Cast the new value to the column's existing type (existing type is in the error message) before writing.","If the schema change is intentional, write to a new field/measurement name or migrate the table schema.","Normalize serializers across all writers so a given field always emits the same type (e.g. always floats, or always integers with 'i').","Use schema validation on the client side against the table's current schema (via the catalog/SHOW APIs) before sending."],"exampleFix":"// before: value=42i while column is Float\nlet lp = \"s temperature=42i 1699999999000000000\";\n// after: match existing Float column type\nlet lp = \"s temperature=42.0 1699999999000000000\";","handlingStrategy":"type-guard","validationCode":"// Rust: check expected schema before writing\nlet expected = catalog.column_type(db, table, \"temperature\");\nlet actual = ColumnType::Float;\nassert_eq!(expected, Some(actual), \"value column type drift: {:?} vs {:?}\", expected, actual);","typeGuard":"fn as_type_mismatch(e: &write_buffer::Error) -> Option<(&str, ColumnType, ColumnType)> {\n  if let write_buffer::Error::ColumnTypeMismatch { name, existing, new } = e {\n    Some((name.as_str(), *existing, *new))\n  } else { None }\n}","tryCatchPattern":"match buffer.write(points).await {\n  Err(write_buffer::Error::ColumnTypeMismatch { name, existing, new }) => {\n    log::warn!(\"coercing column {name} from {new:?} to {existing:?}\");\n    let points = coerce_column(points, &name, existing);\n    buffer.write(points).await\n  }\n  other => other,\n}","preventionTips":["Coerce numeric values to a single consistent type (float or int+i) across all writers.","Fetch the table schema before writing new fields and validate types client-side.","Use distinct field/measurement names when intentionally changing a value's type.","Add schema-drift tests to producer pipelines after agent/library upgrades."],"tags":["type-mismatch","schema","influxdb3","write"],"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"}