cube-js/cube · error

Unexpected value: {:?}

Error message

Unexpected value: {:?}

What it means

In to_execution_plan, when converting in-memory table data to Arrow columns, a String-typed column must contain only TableValue::String values; any other TableValue variant triggers this panic. It is a type-invariant check that column data matches its declared schema.

Source

Thrown at rust/cubestore/cubestore/src/store/mod.rs:148

        let schema = Arc::new(Schema::new(
            columns
                .iter()
                .map(|c| c.clone().into())
                .collect::<Vec<Field>>(),
        ));

        let mut column_values: Vec<Arc<dyn Array>> = Vec::with_capacity(schema.fields().len());

        for c in columns.iter() {
            match c.get_column_type() {
                ColumnType::String => {
                    let mut column = StringBuilder::new();
                    for i in 0..self.data.len() {
                        let value = &self.data[i].values()[c.get_index()];
                        if let TableValue::String(v) = value {
                            column.append_value(v.as_str());
                        } else {
                            panic!("Unexpected value: {:?}", value);
                        }
                    }
                    column_values.push(Arc::new(column.finish()));
                }
                ColumnType::Int => {
                    let mut column = Int64Builder::new();
                    for i in 0..self.data.len() {
                        let value = &self.data[i].values()[c.get_index()];
                        if let TableValue::Int(v) = value {
                            column.append_value(*v);
                        } else {
                            panic!("Unexpected value: {:?}", value);
                        }
                    }
                    column_values.push(Arc::new(column.finish()));
                }
                _ => unimplemented!(),
            }

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Upgrade CubeStore to the latest version
  2. Recreate the affected table / re-ingest the data so schema and values agree
  3. Verify the table's schema in the metastore matches the data files and file a bug with details if not
Defensive patterns

Strategy: try-catch

Try / catch

// not catchable in-process; supervise the process and recreate the table after failure
if crash log matches 'Unexpected value' in store/mod.rs to_execution_plan: stop serving, dump table schema from metastore, drop & re-ingest table, restart.

Prevention

When it happens

Trigger: to_execution_plan building an Arrow StringBuilder for a column declared String while some row holds a non-String TableValue (e.g. Int, Null variant) at that column index.

Common situations: Internal schema/data mismatch, e.g. after a metadata corruption or a bug where a table was created with one schema and filled with values of another; not reachable through normal user APIs.

Related errors


AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02). Data as JSON: /api/errors/6766670e6401a64e. Report an issue: GitHub.