apache/cassandra · error · InvalidRequestException

Cannot set on non-regular table ' .

Error message

Cannot set %s on non-regular table '%s.%s'

What it means

Schema description statements (e.g. DESCRIBE-related security/description labeling) can only target regular tables. If the resolved TableMetadata has a kind other than REGULAR (e.g. a materialized view or virtual table), Cassandra rejects the operation with this InvalidRequestException in validateAndGetTable.

Solutions

  1. Target the base REGULAR table instead of the view/index table name.
  2. Verify the table kind first with system_schema.tables (column `kind`) before running the statement.
  3. If the intent was to describe the view, use the appropriate view description mechanism rather than the table-based statement.

Example fix

// before
ALTER ... ON myks.my_view ...
// after
ALTER ... ON myks.base_table ...
Defensive patterns

Strategy: validation

Validate before calling

// cqlsh
SELECT keyspace_name, table_name, kind FROM system_schema.tables WHERE keyspace_name = 'myks' AND table_name = 'maybe_view';
// only proceed if kind == 'regular'

Prevention

When it happens

Trigger: Executing a schema description statement (e.g. security labels / description settings) against a table name that resolves to a materialized view or other non-regular table kind via validateAndGetTable.

Common situations: Developers passing the name of a materialized view or secondary index backing table instead of the base table; scripts that enumerate tables in a keyspace and hit views; refactoring that renamed a view to look like a table.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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

Appendix: source

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

    {
        KeyspaceMetadata keyspace = schema.getNullable(keyspaceName);

        if (null == keyspace)
            throw ire("Keyspace '%s' doesn't exist", keyspaceName);

        return keyspace;
    }

    protected TableMetadata validateAndGetTable(Keyspaces schema, String tableName)
    {
        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)

View on GitHub (pinned to 88fd0f6a0e)