apache/cassandra · error · InvalidRequestException

Type ' . ' doesn't exist

Error message

Type '%s.%s' doesn't exist

What it means

validateAndGetType looks up a user-defined type (UserType) in the keyspace metadata by name. When no type with that name exists in the resolved keyspace, it throws this InvalidRequestException instead of returning null.

Solutions

  1. Check the type exists: SELECT type_name FROM system_schema.types WHERE keyspace_name = '<ks>';
  2. Fully qualify the type with its keyspace (myks.mytype) or USE the correct keyspace first.
  3. Recreate the missing type with CREATE TYPE if it was accidentally dropped.

Example fix

// before
DESCRIBE TYPE myks.custmer_type
// after
DESCRIBE TYPE myks.customer_type
Defensive patterns

Strategy: validation

Validate before calling

SELECT type_name FROM system_schema.types WHERE keyspace_name = 'myks' AND type_name = 'mytype'; // must return a row before running type statements

Prevention

When it happens

Trigger: Executing a type-affecting statement (e.g. DESCRIBE TYPE myks.mytype or security labels on a type field) where mytype does not exist in the given keyspace; using a type that exists in another keyspace.

Common situations: Typos in the type name; forgetting to qualify with the keyspace when connected to a different keyspace; the type was dropped or never created; environment mismatch (dev vs prod schema).

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


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

Appendix: source

Thrown at src/java/org/apache/cassandra/cql3/statements/schema/SchemaDescriptionStatement.java:102

        KeyspaceMetadata keyspaceMetadata = validateAndGetKeyspace(schema);

        TableMetadata tableMetadata = keyspaceMetadata.getTableOrViewNullable(tableName);
        if (null == tableMetadata)
            throw ire("Table '%s.%s' doesn't exist", keyspaceName, tableName);

        if (tableMetadata.kind != REGULAR)
            throw ire("Cannot set %s on non-regular table '%s.%s'",descriptionType.value, keyspaceName, tableName);

        return tableMetadata;
    }

    protected UserType validateAndGetType(Keyspaces schema, String typeName)
    {
        KeyspaceMetadata keyspaceMetadata = validateAndGetKeyspace(schema);

        UserType type = keyspaceMetadata.types.getNullable(bytes(typeName));
        if (null == type)
            throw ire("Type '%s.%s' doesn't exist", keyspaceName, typeName);

        return type;
    }

    protected UserType validateAndGetTypeField(Keyspaces schema,
                                               String typeName,
                                               FieldIdentifier fieldName)
    {
        UserType type = validateAndGetType(schema, typeName);

        if (type.fieldPosition(fieldName) == -1)
            throw ire("Field '%s' doesn't exist in type '%s.%s'", fieldName, keyspaceName, typeName);

        return type;
    }

    protected String effectiveDescription()
    {

View on GitHub (pinned to 88fd0f6a0e)