influxdata/influxdb · error

expected i64 got

Error message

expected i64 got {}

What it means

unreachable!("expected i64 got {}") panic in MutableBatch::time_column: after locating the TIME_COLUMN_NAME column, the method pattern-matches its ColumnData and expects ColumnData::I64. Any other column data type (Float, String, Timestamp, etc.) triggers an unreachable! panic because the time column must always hold i64 nanosecond timestamps in this data model.

Solutions

  1. Ensure the batch's time column is built as ColumnData::I64 (nanosecond i64 values) at ingestion time
  2. Replace unreachable! with a proper Result/TimeColumnError::InvalidType for graceful handling
  3. Validate column types before calling time_column() by inspecting column(TIME_COLUMN_NAME).data()
  4. Check the write path that constructs the batch for a regression in time-column typing

Example fix

// before
x => unreachable!("expected i64 got {}", x),
// after
x => Err(TimeColumnError::InvalidType(x.to_string())),
Defensive patterns

Strategy: type-guard

Validate before calling

// rust
fn is_i64_time_column(batch: &MutableBatch, name: &str) -> bool {
    matches!(batch.column(name).map(|c| c.data()), Ok(ColumnData::I64(_)))
}

Type guard

// rust
if let ColumnData::I64(col) = &time_column.data() { /* use col */ } else { return Err(...); }

Try / catch

match batch.time_column() {
    Ok(c) => c,
    Err(TimeColumnError::NotFound) => return Err("no time column".into()),
}

Prevention

When it happens

Trigger: Calling time_column() on a MutableBatch whose 'time' column was created with a non-I64 ColumnData variant — e.g. a batch constructed with a Timestamp-typed or String-typed time column, or a column inserted under the wrong name/type by upstream write-path code.

Common situations: Writing rows where the time column was ingested with an unexpected type, schema drift between writer and partition reader, or test fixtures that build the time column with the wrong arrow type.

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/68b47c0bfb1d4419. Report an issue: GitHub.

Appendix: source

Thrown at core/partition/src/traits/mutable_batch.rs:58

impl Batch for MutableBatch {
    type Column = MutableBatchColumn;

    fn num_rows(&self) -> usize {
        self.rows()
    }

    fn column(&self, column: &str) -> Option<&Self::Column> {
        self.column(column).ok()
    }

    fn time_column(&self) -> Result<&[i64], TimeColumnError> {
        let time_column = self
            .column(TIME_COLUMN_NAME)
            .map_err(|_| TimeColumnError::NotFound)?;

        match &time_column.data() {
            ColumnData::I64(col_data) => Ok(col_data),
            x => unreachable!("expected i64 got {}", x),
        }
    }
}

View on GitHub (pinned to 06200ef96b)