influxdata/influxdb · error · CatalogError

invalid column type for column

Error message

invalid column type for column '{column_name}', expected {expected}, got {got}

What it means

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.

Solutions

  1. Inspect the table schema and change the incoming write/operation to use the existing column type.
  2. Use a differently named column for the new type instead of conflicting with the existing one.
  3. If the schema itself is wrong, migrate the table: create a new column of the correct type, backfill, and drop the old one.

Example fix

// before
line: 'cpu temp=72i'  // temp is float in schema -> InvalidColumnType
// after
line: 'cpu temp=72.0'
Defensive patterns

Strategy: validation

Validate before calling

async function assertColumnType(db, table, col, expectedType) {
  const schema = await getTableSchema(db, table);
  const actual = schema.columns.find(c => c.name === col)?.type;
  if (actual !== expectedType) throw new Error(`${col} is ${actual}, expected ${expectedType}`);
}

Type guard

const columnMatches = (schema, name, type) =>
  schema.columns.some(c => c.name === name && c.type === type);

Try / catch

try {
  await writePoint(point);
} catch (e) {
  if (e.message.includes("invalid column type")) {
    await alignWriterSchemaWithCatalog(); // resync writer to catalog types
  } else { throw e; }
}

Prevention

When it happens

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

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

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/465b502c1fc68924. Report an issue: GitHub.

Appendix: source

Thrown at influxdb3_catalog/src/error.rs:90

        live_sequence: u64,
    },

    #[error("invalid configuration provided: {message}")]
    InvalidConfiguration { message: Box<str> },

    #[error("only tag and string columns are supported in the distinct cache")]
    InvalidDistinctCacheColumnType,

    #[error("only uint64, int64, bool, tag, and string columns are supported in the last cache")]
    InvalidLastCacheKeyColumnType,

    #[error("plugin trigger is already enabled")]
    TriggerAlreadyEnabled,

    #[error("plugin trigger is already disabled")]
    TriggerAlreadyDisabled,

    #[error("invalid column type for column '{column_name}', expected {expected}, got {got}")]
    InvalidColumnType {
        column_name: Arc<str>,
        expected: InfluxColumnType,
        got: InfluxColumnType,
    },

    #[error("'{0}' is a reserved column")]
    ReservedColumn(Arc<str>),

    #[error(
        "table '{table_name}' is not defined in database '{db_name}', which uses explicit schemas; \
         create the table with the /api/v3/configure/table API before writing to it"
    )]
    UndeclaredTable {
        db_name: Arc<str>,
        table_name: Arc<str>,
    },

View on GitHub (pinned to 06200ef96b)