apache/cassandra · error · ConfigurationException

category %s not found in %s

Error message

category %s not found in %s

What it means

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.

Source

Thrown at src/java/org/apache/cassandra/audit/AuditLogOptions.java:281

        }
    }

    private static void validateCategories(final String categories)
    {
        assert categories != null;

        if (categories.isEmpty())
            return;

        for (final String includedCategory : categories.split(","))
        {
            try
            {
                AuditLogEntryCategory.valueOf(includedCategory);
            }
            catch (final IllegalArgumentException ex)
            {
                throw new ConfigurationException(String.format("category %s not found in %s",
                                                               includedCategory,
                                                               AuditLogEntryCategory.class.getName()),
                                                 ex);
            }
        }
    }

    public String toString()
    {
        return "AuditLogOptions{" +
               "enabled=" + enabled +
               ", logger='" + logger + '\'' +
               ", included_keyspaces='" + included_keyspaces + '\'' +
               ", excluded_keyspaces='" + excluded_keyspaces + '\'' +
               ", included_categories='" + included_categories + '\'' +
               ", excluded_categories='" + excluded_categories + '\'' +
               ", included_users='" + included_users + '\'' +
               ", excluded_users='" + excluded_users + '\'' +

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Run 'DESCRIBE KEYSPACES' (or query system_schema.keyspaces) and confirm the target keyspace exists.
  2. Create the keyspace first with CREATE KEYSPACE ... WITH replication = {...}, then re-run the CREATE TYPE.
  3. Correct the keyspace qualifier in the statement, matching case or quoting it ('CREATE TYPE "MyKS".t ...').
  4. Verify you are connected to the intended cluster/contact point and that schema has fully propagated after any recent DDL.

Example fix

// before
CREATE TYPE orders.address (street text, city text);
// after
CREATE KEYSPACE IF NOT EXISTS orders WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 3};
CREATE TYPE orders.address (street text, city text);
Defensive patterns

Strategy: validation

Validate before calling

Row r = session.execute("SELECT keyspace_name FROM system_schema.keyspaces WHERE keyspace_name = ?", ksName).one();
if (r == null) throw new IllegalStateException("Keyspace does not exist: " + ksName);

Type guard

boolean keyspaceExists(Session s, String ks) {
    return s.execute("SELECT keyspace_name FROM system_schema.keyspaces WHERE keyspace_name = ?", ks).one() != null;
}

Try / catch

try {
    session.execute(createTypeStmt);
} catch (InvalidQueryException e) {
    if (e.getMessage().contains("doesn't exist")) { ensureKeyspace(ksName); retry(createTypeStmt); }
    else throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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