apache/cassandra · error · InvalidRequestException

Base table ' ' doesn't exist

Error message

Base table '%s' doesn't exist

What it means

Dependency check in CreateViewStatement.apply(): the base table named in the CREATE MATERIALIZED VIEW statement does not exist in the (already resolved) keyspace. A materialized view is derived from a base table, so creation is aborted with InvalidRequestException when keyspace.tables has no entry for tableName.

Solutions

  1. Create the base table before creating the view; check the table name spelling, quoting, and keyspace qualification; verify the table still exists (it may have been dropped concurrently) with DESCRIBE TABLES.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/java/org/apache/cassandra/cql3/statements/schema/CreateViewStatement.java:155 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at src/java/org/apache/cassandra/cql3/statements/schema/CreateViewStatement.java:155

    }

    @Override
    public Keyspaces apply(ClusterMetadata metadata)
    {
        /*
         * Basic dependency validations
         */
        Keyspaces schema = metadata.schema.getKeyspaces();
        KeyspaceMetadata keyspace = schema.getNullable(keyspaceName);
        if (null == keyspace)
            throw ire("Keyspace '%s' doesn't exist", keyspaceName);

        if (keyspace.replicationStrategy.hasTransientReplicas())
            throw new InvalidRequestException("Materialized views are not supported on transiently replicated keyspaces");

        TableMetadata table = keyspace.tables.getNullable(tableName);
        if (null == table)
            throw ire("Base table '%s' doesn't exist", tableName);

        if (keyspace.hasTable(viewName))
            throw ire("Cannot create materialized view '%s' - a table with the same name already exists", viewName);

        if (keyspace.hasView(viewName))
        {
            if (ifNotExists)
                return schema;

            throw new AlreadyExistsException(keyspaceName, viewName);
        }

        /*
         * Base table validation
         */

        if (table.isCounter())
            throw ire("Materialized views are not supported on counter tables");

View on GitHub (pinned to 88fd0f6a0e)