apache/cassandra · error · InvalidRequestException

' ' not found in keyspace

Error message

'%s' not found in keyspace '%s'

What it means

Thrown by the CQL DESCRIBE machinery in DescribeStatement when resolving an object name against a keyspace: the named table/type/index/view does not exist in the given keyspace. The library throws it because DESCRIBE was asked for an entity the schema cannot resolve. It is an InvalidRequestException raised from resolve() during describe().

Solutions

  1. Verify the object exists with `DESCRIBE KEYSPACES` or `SELECT table_name FROM system_schema.tables WHERE keyspace_name = '<ks>'`
  2. Correct the identifier spelling and respect case sensitivity: quote mixed-case names ("MyTable") or use lowercase
  3. Fully qualify the name (keyspace.object) or run USE <keyspace> first to target the right keyspace
  4. Check you are connected to the intended cluster/environment where the object was created

Example fix

// before
DESCRIBE TABLE users_profiles; -- InvalidRequest: 'users_profiles' not found in keyspace 'myks'
// after
DESCRIBE TABLE myks.user_profiles; -- correct, existing table
Defensive patterns

Strategy: validation

Validate before calling

Row[] rows = session.execute("SELECT table_name FROM system_schema.tables WHERE keyspace_name = ?", ks).all();
boolean exists = rows.stream().anyMatch(r -> r.getString("table_name").equalsIgnoreCase(name));
if (!exists) throw new IllegalArgumentException(name + " not found in keyspace " + ks);

Try / catch

try { session.execute("DESCRIBE TABLE " + name); }
catch (InvalidRequestException e) { /* handle missing object: e.g. create it or fall back */ }

Prevention

When it happens

Trigger: Running DESCRIBE TABLE/TYPE/INDEX/VIEW <name> (or calling DescribeStatement.execute/describe programmatically) where `name` matches no table, materialized view, or index in the resolved keyspace `ks`.

Common situations: Typo in table name; querying the wrong keyspace (missing USE or fully-qualified name); case sensitivity issues since unquoted identifiers are lowercased; the object was dropped by another client or was never created in this cluster/environment (e.g. staging vs prod).

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/dd2d1e0214d7b654. Report an issue: GitHub.

Appendix: source

Thrown at src/java/org/apache/cassandra/cql3/statements/DescribeStatement.java:676

                }

                KeyspaceMetadata keyspaceMetadata = validateKeyspace(ks, keyspaces);

                if (keyspaceMetadata.tables.getNullable(name) != null)
                    return table(ks, name);

                Optional<TableMetadata> indexed = keyspaceMetadata.findIndexedTable(name);
                if (indexed.isPresent())
                {
                    Optional<IndexMetadata> index = indexed.get().indexes.get(name);
                    if (index.isPresent())
                        return index(ks, name);
                }

                if (keyspaceMetadata.views.getNullable(name) != null)
                    return view(ks, name);

                throw invalidRequest("'%s' not found in keyspace '%s'", name, ks);
            }

            @Override
            protected Stream<? extends SchemaElement> describe(ClientState state, Keyspaces keyspaces)
            {
                delegate = resolve(state, keyspaces);
                return delegate.describe(state, keyspaces);
            }

            @Override
            protected List<ColumnSpecification> metadata(ClientState state)
            {
                return delegate.metadata(state);
            }

            @Override
            protected List<ByteBuffer> toRow(SchemaElement element, boolean withInternals)
            {

View on GitHub (pinned to 88fd0f6a0e)