{"record":{"id":"5e8b325cadfaa7cc","repo":"apache/cassandra","slug":"unknown-object-type-objecttype-valid-t","errorCode":null,"errorMessage":"Unknown object type: '\" + objectType + \"'. Valid types are: \" + Arrays.toString(ObjectType.values())","messagePattern":"Unknown object type: '\" \\+ objectType \\+ \"'\\. Valid types are: \" \\+ Arrays\\.toString\\(ObjectType\\.values\\(\\)\\)","errorType":"validation","errorClass":"InvalidRequestException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/db/virtual/AbstractSchemaMetadataTable.java","lineNumber":223,"sourceCode":"    }\n\n    @Override\n    public DataSet data(DecoratedKey partitionKey)\n    {\n        SimpleDataSet result = new SimpleDataSet(metadata());\n\n        ByteBuffer key = partitionKey.getKey();\n        ByteBuffer[] components = ((CompositeType) metadata().partitionKeyType).split(key);\n        String objectType = UTF8Type.instance.compose(components[0]);\n        String keyspaceName = UTF8Type.instance.compose(components[1]);\n\n        KeyspaceMetadata keyspace = Schema.instance.getKeyspaceMetadata(keyspaceName);\n        if (keyspace == null)\n            throw new InvalidRequestException(\"Unknown keyspace: '\" + keyspaceName + '\\'');\n\n        ObjectType type = ObjectType.parse(objectType);\n        if (type == null)\n            throw new InvalidRequestException(\"Unknown object type: '\" + objectType +\n                                              \"'. Valid types are: \" + Arrays.toString(ObjectType.values()));\n\n        switch (type)\n        {\n            case KEYSPACE:\n                addKeyspaceRow(result, keyspace);\n                break;\n            case TABLE:\n                for (TableMetadata table : keyspace.tables)\n                    addTableRow(result, keyspace, table);\n                break;\n            case COLUMN:\n                for (TableMetadata table : keyspace.tables)\n                    for (ColumnMetadata column : table.columns())\n                        addColumnRow(result, keyspace, table, column);\n                break;\n            case UDT:\n                for (UserType udt : keyspace.types)","sourceCodeStart":205,"sourceCodeEnd":241,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/virtual/AbstractSchemaMetadataTable.java#L205-L241","documentation":"After resolving the keyspace, AbstractSchemaMetadataTable parses the first key component as an ObjectType (KEYSPACE, TABLE, etc.). If the component string is not a valid ObjectType name, InvalidRequestException is thrown listing the valid types. This indicates the queried object type token is malformed.","triggerScenarios":"SELECT from the schema-metadata virtual table with a partition key whose first component is a misspelled or unsupported object type, e.g. 'view' or 'index' where only enum values like keyspace/table/type/function are accepted.","commonSituations":"Hand-written partition-key queries against schema virtual tables using guessed type strings; tooling generating keys from internal metadata with different casing or vocabulary; version drift where newer object types don't exist in this release.","solutions":["Use one of the valid type strings printed in the error (match exact case, e.g. 'table', not 'tables')","Prefer querying the dedicated system_schema tables (system_schema.tables, etc.) instead of constructing partition keys manually","Upgrade tooling that emits object-type tokens to match this Cassandra version's ObjectType enum"],"exampleFix":"// before\nSELECT * FROM system_schema_virtual.tables WHERE object_type = 'view';\n// after\nSELECT * FROM system_schema_virtual.tables WHERE object_type = 'table' AND keyspace_name = 'ks';\n// or query system_schema.views directly","handlingStrategy":"validation","validationCode":"Set<String> valid = Set.of(\"keyspace\",\"table\",\"type\",\"function\"); // per ObjectType enum\nif (!valid.contains(objectType.toLowerCase())) throw new IllegalArgumentException(\"bad object type: \" + objectType);","typeGuard":null,"tryCatchPattern":"try { session.execute(q); } catch (InvalidRequestException e) { if (e.getMessage().startsWith(\"Unknown object type\")) useValidTypeFromMessage(); else throw e; }","preventionTips":["Query dedicated system_schema.* tables instead of constructing partition keys","Match ObjectType names exactly (singular, correct case)","Keep tooling in sync with the cluster's Cassandra version"],"tags":["cql","virtual-table","schema","enum","invalid-request"],"backgroundTag":"invalid-enum-value","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}