{"record":{"id":"34643d03c30ee09d","repo":"apache/cassandra","slug":"category-s-not-found-in-s","errorCode":null,"errorMessage":"category %s not found in %s","messagePattern":"category (.+?) not found in (.+?)","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/audit/AuditLogOptions.java","lineNumber":281,"sourceCode":"        }\n    }\n\n    private static void validateCategories(final String categories)\n    {\n        assert categories != null;\n\n        if (categories.isEmpty())\n            return;\n\n        for (final String includedCategory : categories.split(\",\"))\n        {\n            try\n            {\n                AuditLogEntryCategory.valueOf(includedCategory);\n            }\n            catch (final IllegalArgumentException ex)\n            {\n                throw new ConfigurationException(String.format(\"category %s not found in %s\",\n                                                               includedCategory,\n                                                               AuditLogEntryCategory.class.getName()),\n                                                 ex);\n            }\n        }\n    }\n\n    public String toString()\n    {\n        return \"AuditLogOptions{\" +\n               \"enabled=\" + enabled +\n               \", logger='\" + logger + '\\'' +\n               \", included_keyspaces='\" + included_keyspaces + '\\'' +\n               \", excluded_keyspaces='\" + excluded_keyspaces + '\\'' +\n               \", included_categories='\" + included_categories + '\\'' +\n               \", excluded_categories='\" + excluded_categories + '\\'' +\n               \", included_users='\" + included_users + '\\'' +\n               \", excluded_users='\" + excluded_users + '\\'' +","sourceCodeStart":263,"sourceCodeEnd":299,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/audit/AuditLogOptions.java#L263-L299","documentation":"Thrown by CreateTypeStatement.apply when a CREATE TYPE statement targets a keyspace that does not exist in the cluster schema. The statement resolves the parent keyspace from ClusterMetadata before adding the user type; if schema.getNullable(keyspaceName) returns null the DDL is rejected as an InvalidRequestException. This is a fail-fast schema dependency check, not an internal failure.","triggerScenarios":"Executing 'CREATE TYPE ks.newType (...)' where ks was never created, was dropped concurrently, or the keyspace name (case-sensitively resolved unless quoted) does not exist on the connected cluster.","commonSituations":"Typos in the keyspace name; running the DDL script against the wrong cluster or environment (dev vs prod); a DROP KEYSPACE executed by another client between the script's CREATE KEYSPACE and CREATE TYPE; scripts that assume the current keyspace without qualifying the name.","solutions":["Run 'DESCRIBE KEYSPACES' (or query system_schema.keyspaces) and confirm the target keyspace exists.","Create the keyspace first with CREATE KEYSPACE ... WITH replication = {...}, then re-run the CREATE TYPE.","Correct the keyspace qualifier in the statement, matching case or quoting it ('CREATE TYPE \"MyKS\".t ...').","Verify you are connected to the intended cluster/contact point and that schema has fully propagated after any recent DDL."],"exampleFix":"// before\nCREATE TYPE orders.address (street text, city text);\n// after\nCREATE KEYSPACE IF NOT EXISTS orders WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 3};\nCREATE TYPE orders.address (street text, city text);","handlingStrategy":"validation","validationCode":"Row r = session.execute(\"SELECT keyspace_name FROM system_schema.keyspaces WHERE keyspace_name = ?\", ksName).one();\nif (r == null) throw new IllegalStateException(\"Keyspace does not exist: \" + ksName);","typeGuard":"boolean keyspaceExists(Session s, String ks) {\n    return s.execute(\"SELECT keyspace_name FROM system_schema.keyspaces WHERE keyspace_name = ?\", ks).one() != null;\n}","tryCatchPattern":"try {\n    session.execute(createTypeStmt);\n} catch (InvalidQueryException e) {\n    if (e.getMessage().contains(\"doesn't exist\")) { ensureKeyspace(ksName); retry(createTypeStmt); }\n    else throw e;\n}","preventionTips":["Always create keyspaces and types in the same ordered migration script.","Use fully-qualified names and consistent casing (quote identifiers if needed).","Check schema with DESCRIBE/system_schema before DDL in deployment automation."],"tags":["cassandra","cql","ddl","schema","user-type"],"backgroundTag":"resource-not-found","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"}