apache/cassandra · error · IllegalStateException

Unknown column type: " + type

Error message

Unknown column type: " + type

What it means

CollectionVirtualTableAdapter builds virtual-table metadata by iterating columns and, for each Column.Type not equal to PARTITION_KEY, CLUSTERING, REGULAR or STATIC, hits the switch default. Column.Type is an exhaustive enum covering those kinds, so reaching default indicates a new/unknown column kind or corrupted type value; an IllegalStateException is thrown.

Solutions

  1. Check the Column.Type enum in your build and confirm which constant reaches the default branch.
  2. Update CollectionVirtualTableAdapter to handle the new column type (e.g. add a case or route STATIC columns appropriately).
  3. Align the adapter source with the Cassandra version you are running — version mismatch between the adapter and the core Column.Type enum is the usual cause.
  4. As a defensive measure, skip or log unrecognized columns instead of throwing when the kind is nonessential.

Example fix

// before
default:
    throw new IllegalStateException("Unknown column type: " + type);
// after
case STATIC:
    builder.addStaticColumn(columnName, converters.get(clazz));
    break;
default:
    throw new IllegalStateException("Unknown column type: " + type);
Defensive patterns

Strategy: type-guard

Validate before calling

boolean isSupportedColumnKind(Column.Type type) {
    switch (type) {
        case PARTITION_KEY:
        case CLUSTERING:
        case REGULAR:
        case STATIC:
            return true;
        default:
            return false;
    }
}

Type guard

boolean supportedKind(Column.Type t) {
    return t == Column.Type.PARTITION_KEY
        || t == Column.Type.CLUSTERING
        || t == Column.Type.REGULAR
        || t == Column.Type.STATIC;
}

Try / catch

try {
    adapter.accept(...); // builds metadata
} catch (IllegalStateException e) {
    if (e.getMessage().startsWith("Unknown column type")) {
        logger.error("Adapter does not support this Column.Type; upgrade adapter", e);
    } else throw e;
}

Prevention

When it happens

Trigger: Adding a column to the adapted collection virtual table whose Column.Type is not one of the handled kinds (e.g. a future enum constant added upstream without updating this adapter), or a column definition whose type enum value is unexpected when metadata is rebuilt at table creation/accept time.

Common situations: Running a patched/older CollectionVirtualTableAdapter against a newer Cassandra version that introduced a new column kind; custom code constructing Column objects with a type the adapter does not support.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/ac890f4843bd51d4. Report an issue: GitHub.

Appendix: source

Thrown at src/java/org/apache/cassandra/db/virtual/CollectionVirtualTableAdapter.java:295

        walker.visitMeta(new RowWalker.MetadataVisitor()
        {
            @Override
            public <T> void accept(Column.Type type, String columnName, Class<T> clazz)
            {
                switch (type)
                {
                    case PARTITION_KEY:
                        partitionKeyTypes.add(converters.get(clazz));
                        builder.addPartitionKeyColumn(columnName, converters.get(clazz));
                        break;
                    case CLUSTERING:
                        builder.addClusteringColumn(columnName, converters.get(clazz));
                        break;
                    case REGULAR:
                        builder.addRegularColumn(columnName, converters.get(clazz));
                        break;
                    default:
                        throw new IllegalStateException("Unknown column type: " + type);
                }
            }
        });

        if (partitionKeyTypes.size() == 1)
            builder.partitioner(new LocalPartitioner(partitionKeyTypes.get(0)));
        else if (partitionKeyTypes.size() > 1)
            builder.partitioner(new LocalPartitioner(CompositeType.getInstance(partitionKeyTypes)));

        return builder.build();
    }

    @Override
    public UnfilteredPartitionIterator select(DecoratedKey partitionKey,
                                              ClusteringIndexFilter clusteringFilter,
                                              ColumnFilter columnFilter,
                                              RowFilter rowFilter, DataLimits limits)
    {

View on GitHub (pinned to 88fd0f6a0e)