influxdata/influxdb · error · Error

column type mismatch for column

Error message

column type mismatch for column {name}: existing: {existing:?}, new: {new:?}

What it means

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.

Solutions

  1. Cast the new value to the column's existing type (existing type is in the error message) before writing.
  2. If the schema change is intentional, write to a new field/measurement name or migrate the table schema.
  3. Normalize serializers across all writers so a given field always emits the same type (e.g. always floats, or always integers with 'i').
  4. Use schema validation on the client side against the table's current schema (via the catalog/SHOW APIs) before sending.

Example fix

// before: value=42i while column is Float
let lp = "s temperature=42i 1699999999000000000";
// after: match existing Float column type
let lp = "s temperature=42.0 1699999999000000000";
Defensive patterns

Strategy: type-guard

Validate before calling

// Rust: check expected schema before writing
let expected = catalog.column_type(db, table, "temperature");
let actual = ColumnType::Float;
assert_eq!(expected, Some(actual), "value column type drift: {:?} vs {:?}", expected, actual);

Type guard

fn as_type_mismatch(e: &write_buffer::Error) -> Option<(&str, ColumnType, ColumnType)> {
  if let write_buffer::Error::ColumnTypeMismatch { name, existing, new } = e {
    Some((name.as_str(), *existing, *new))
  } else { None }
}

Try / catch

match buffer.write(points).await {
  Err(write_buffer::Error::ColumnTypeMismatch { name, existing, new }) => {
    log::warn!("coercing column {name} from {new:?} to {existing:?}");
    let points = coerce_column(points, &name, existing);
    buffer.write(points).await
  }
  other => other,
}

Prevention

When it happens

Trigger: 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).

Common situations: 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).

Understand the failure class

Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.

Related errors


AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19). Data as JSON: /api/errors/469dc6f4ffdffc89. Report an issue: GitHub.

Appendix: source

Thrown at influxdb3_write/src/write_buffer/mod.rs:76

use queryable_buffer::QueryableBufferArgs;
use schema::Schema;
use std::{
    borrow::Borrow,
    num::{NonZeroU64, NonZeroUsize},
    sync::Arc,
    time::Duration,
};
use thiserror::Error;

#[derive(Debug, Error)]
pub enum Error {
    #[error("line protocol parse failed: {}", .0.error_message)]
    ParseError(WriteLineError),

    #[error("incoming write was empty")]
    EmptyWrite,

    #[error("column type mismatch for column {name}: existing: {existing:?}, new: {new:?}")]
    ColumnTypeMismatch {
        name: String,
        existing: ColumnType,
        new: ColumnType,
    },

    #[error("catalog update error: {0}")]
    CatalogUpdateError(#[from] CatalogError),

    #[error("error from persister: {0}")]
    PersisterError(#[from] PersisterError),

    #[error("corrupt load state: {0}")]
    CorruptLoadState(String),

    #[error("database name error: {0}")]
    DatabaseNameError(#[from] DatabaseNameError),

View on GitHub (pinned to 06200ef96b)