{"record":{"id":"ac890f4843bd51d4","repo":"apache/cassandra","slug":"unknown-column-type-type","errorCode":null,"errorMessage":"Unknown column type: \" + type","messagePattern":"Unknown column type: \" \\+ type","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/db/virtual/CollectionVirtualTableAdapter.java","lineNumber":295,"sourceCode":"        walker.visitMeta(new RowWalker.MetadataVisitor()\n        {\n            @Override\n            public <T> void accept(Column.Type type, String columnName, Class<T> clazz)\n            {\n                switch (type)\n                {\n                    case PARTITION_KEY:\n                        partitionKeyTypes.add(converters.get(clazz));\n                        builder.addPartitionKeyColumn(columnName, converters.get(clazz));\n                        break;\n                    case CLUSTERING:\n                        builder.addClusteringColumn(columnName, converters.get(clazz));\n                        break;\n                    case REGULAR:\n                        builder.addRegularColumn(columnName, converters.get(clazz));\n                        break;\n                    default:\n                        throw new IllegalStateException(\"Unknown column type: \" + type);\n                }\n            }\n        });\n\n        if (partitionKeyTypes.size() == 1)\n            builder.partitioner(new LocalPartitioner(partitionKeyTypes.get(0)));\n        else if (partitionKeyTypes.size() > 1)\n            builder.partitioner(new LocalPartitioner(CompositeType.getInstance(partitionKeyTypes)));\n\n        return builder.build();\n    }\n\n    @Override\n    public UnfilteredPartitionIterator select(DecoratedKey partitionKey,\n                                              ClusteringIndexFilter clusteringFilter,\n                                              ColumnFilter columnFilter,\n                                              RowFilter rowFilter, DataLimits limits)\n    {","sourceCodeStart":277,"sourceCodeEnd":313,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/virtual/CollectionVirtualTableAdapter.java#L277-L313","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check the Column.Type enum in your build and confirm which constant reaches the default branch.","Update CollectionVirtualTableAdapter to handle the new column type (e.g. add a case or route STATIC columns appropriately).","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.","As a defensive measure, skip or log unrecognized columns instead of throwing when the kind is nonessential."],"exampleFix":"// before\ndefault:\n    throw new IllegalStateException(\"Unknown column type: \" + type);\n// after\ncase STATIC:\n    builder.addStaticColumn(columnName, converters.get(clazz));\n    break;\ndefault:\n    throw new IllegalStateException(\"Unknown column type: \" + type);","handlingStrategy":"type-guard","validationCode":"boolean isSupportedColumnKind(Column.Type type) {\n    switch (type) {\n        case PARTITION_KEY:\n        case CLUSTERING:\n        case REGULAR:\n        case STATIC:\n            return true;\n        default:\n            return false;\n    }\n}\n","typeGuard":"boolean supportedKind(Column.Type t) {\n    return t == Column.Type.PARTITION_KEY\n        || t == Column.Type.CLUSTERING\n        || t == Column.Type.REGULAR\n        || t == Column.Type.STATIC;\n}\n","tryCatchPattern":"try {\n    adapter.accept(...); // builds metadata\n} catch (IllegalStateException e) {\n    if (e.getMessage().startsWith(\"Unknown column type\")) {\n        logger.error(\"Adapter does not support this Column.Type; upgrade adapter\", e);\n    } else throw e;\n}\n","preventionTips":["Keep CollectionVirtualTableAdapter in sync with the Column.Type enum of your Cassandra build.","After upgrading Cassandra, re-verify custom virtual-table adapters compile against the new enum.","Filter unsupported column kinds before feeding columns into the adapter.","Add unit tests covering every Column.Type constant handled by the adapter."],"tags":["cassandra","virtual-table","enum","internal"],"backgroundTag":"unsupported-enum-value","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}