cube-js/cube · error
Unsupported data type for List: {}
Error message
Unsupported data type for List: {} What it means
When mapping Cube's internal DataType to a PostgreSQL wire type for list/array columns, only a fixed set of element types is translated. Any other element type falls into a catch-all unimplemented! panic, since no corresponding PgTypeId ARRAY OID exists in the mapping.
Source
Thrown at rust/cubesql/cubesql/src/sql/types.rs:70
ColumnType::Int8 => PgTypeId::INT2,
ColumnType::Int32 => PgTypeId::INT4,
ColumnType::String | ColumnType::VarStr => PgTypeId::TEXT,
ColumnType::Interval(_) => PgTypeId::INTERVAL,
ColumnType::Date(_) => PgTypeId::DATE,
ColumnType::Timestamp => PgTypeId::TIMESTAMP,
ColumnType::Double => PgTypeId::NUMERIC,
ColumnType::Decimal(_, _) => PgTypeId::NUMERIC,
ColumnType::List(field) => match field.data_type() {
DataType::Binary => PgTypeId::ARRAYBYTEA,
DataType::Boolean => PgTypeId::ARRAYBOOL,
DataType::Utf8 => PgTypeId::ARRAYTEXT,
DataType::Int16 => PgTypeId::ARRAYINT2,
DataType::Int32 => PgTypeId::ARRAYINT4,
DataType::Int64 => PgTypeId::ARRAYINT8,
DataType::UInt16 => PgTypeId::ARRAYINT2,
DataType::UInt32 => PgTypeId::ARRAYINT4,
DataType::UInt64 => PgTypeId::ARRAYINT8,
dt => unimplemented!("Unsupported data type for List: {}", dt),
},
}
}
pub fn avg_size(&self) -> usize {
match self {
ColumnType::Boolean | ColumnType::Int8 => 1,
ColumnType::Int32
| ColumnType::Date(true)
| ColumnType::Interval(IntervalUnit::YearMonth) => 4,
ColumnType::Double
| ColumnType::Int64
| ColumnType::Date(false)
| ColumnType::Interval(IntervalUnit::DayTime)
| ColumnType::Timestamp => 8,
ColumnType::Interval(IntervalUnit::MonthDayNano) | ColumnType::Decimal(_, _) => 16,
ColumnType::String | ColumnType::VarStr => 64,
ColumnType::Blob | ColumnType::List(_) => 128,View on GitHub (pinned to 7d981676b3)
Solutions
- Cast the array elements to a supported type (int) in the data model or query before returning
- Avoid exposing array columns of unhandled element types over the Postgres protocol
- Add the missing mapping (e.g. Utf8 -> a text array PgTypeId) in types.rs:70
- Unnest the array into scalar rows in the query
Example fix
// before
dt => unimplemented!("Unsupported data type for List: {}", dt),
// after
DataType::Utf8 => PgTypeId::ARRAYTEXT,
dt => PgTypeId::ARRAYTEXT, // fallback with a warning log Defensive patterns
Strategy: validation
Validate before calling
fn list_element_supported(dt: &DataType) -> bool {
matches!(dt, DataType::List(f) if matches!(f.data_type(), DataType::Int16|DataType::Int32|DataType::Int64|DataType::UInt16|DataType::UInt32|DataType::UInt64))
} Type guard
fn to_pg_array_type(dt: &DataType) -> Option<PgTypeId> {
match dt { DataType::Int64 => Some(PgTypeId::ARRAYINT8), DataType::Utf8 => Some(PgTypeId::ARRAYTEXT), _ => None }
} Try / catch
match to_pg_type(dt) {
Some(t) => t,
None => { log::warn!("falling back to text for {}", dt); PgTypeId::ARRAYTEXT }
} Prevention
- Expose only supported array element types through the Postgres protocol
- Cast arrays to supported element types in the data model
- Maintain a table-driven mapping so adding types is explicit
- Cover each DataType with protocol serialization tests
When it happens
Trigger: add_attribute serializing a result column that is a List whose element DataType is not one of the handled numeric types — e.g. list of strings, booleans, decimals, or dates.
Common situations: Queries returning arrays of non-integer elements through the Postgres protocol; data models that expose array fields whose element types weren't anticipated by the type mapping table.
Related errors
- Unsupported data type: {:?}
- Unimplemented support for {:?}
- Unable to convert List of {} to string
- Unable to detect type for field "${f.name}" with dataTypeID:
- PostgreSQL can not work with table names longer than 63 symb
AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02).
Data as JSON: /api/errors/33d021443179fa6c.
Report an issue: GitHub.