{"record":{"id":"4cf4e080d1edff15","repo":"apache/cassandra","slug":"keyspace-s-doesn-t-exist-4cf4e0","errorCode":null,"errorMessage":"Keyspace '%s' doesn't exist","messagePattern":"Keyspace '(.+?)' doesn't exist","errorType":"validation","errorClass":"InvalidRequestException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/cql3/statements/schema/CreateViewStatement.java","lineNumber":148,"sourceCode":"        this.state = state;\n    }\n\n    @Override\n    public boolean compatibleWith(ClusterMetadata metadata)\n    {\n        return metadata.directory.commonSerializationVersion.isAtLeast(Version.V0);\n    }\n\n    @Override\n    public Keyspaces apply(ClusterMetadata metadata)\n    {\n        /*\n         * Basic dependency validations\n         */\n        Keyspaces schema = metadata.schema.getKeyspaces();\n        KeyspaceMetadata keyspace = schema.getNullable(keyspaceName);\n        if (null == keyspace)\n            throw ire(\"Keyspace '%s' doesn't exist\", keyspaceName);\n\n        if (keyspace.replicationStrategy.hasTransientReplicas())\n            throw new InvalidRequestException(\"Materialized views are not supported on transiently replicated keyspaces\");\n\n        TableMetadata table = keyspace.tables.getNullable(tableName);\n        if (null == table)\n            throw ire(\"Base table '%s' doesn't exist\", tableName);\n\n        if (keyspace.hasTable(viewName))\n            throw ire(\"Cannot create materialized view '%s' - a table with the same name already exists\", viewName);\n\n        if (keyspace.hasView(viewName))\n        {\n            if (ifNotExists)\n                return schema;\n\n            throw new AlreadyExistsException(keyspaceName, viewName);\n        }","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/cql3/statements/schema/CreateViewStatement.java#L130-L166","documentation":"Dependency check in CreateViewStatement.apply() during schema mutation: the keyspace the materialized view is to be created in (keyspaceName) is not present in the current cluster metadata. Since a view cannot exist without its parent keyspace, the coordinator rejects the change with InvalidRequestException naming the missing keyspace.","triggerScenarios":"Thrown at src/java/org/apache/cassandra/cql3/statements/schema/CreateViewStatement.java:148 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Create the keyspace first (CREATE KEYSPACE) then retry the CREATE MATERIALIZED VIEW; verify the keyspace name spelling and case; USE the correct keyspace or fully qualify the view name if the statement resolved to the wrong keyspace."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}