{"record":{"id":"807d8a4691d98e8d","repo":"apache/cassandra","slug":"not-found-in-keyspace","errorCode":null,"errorMessage":"'{}' not found in keyspace '{}'","messagePattern":"'(.+?)' not found in keyspace '(.+?)'","errorType":"exception","errorClass":"ObjectNotFound","httpStatus":null,"severity":"error","filePath":"pylib/cqlshlib/cqlshmain.py","lineNumber":635,"sourceCode":"            elif self.current_keyspace is None:\n                raise ObjectNotFound(\"'{}' not found in keyspaces\".format(ks))\n            else:\n                name = ks\n                ks = self.current_keyspace\n\n        if ks is None:\n            ks = self.current_keyspace\n\n        ksmeta = self.get_keyspace_meta(ks)\n\n        if name in ksmeta.tables:\n            return ksmeta.tables[name]\n        elif name in ksmeta.indexes:\n            return ksmeta.indexes[name]\n        elif name in ksmeta.views:\n            return ksmeta.views[name]\n\n        raise ObjectNotFound(\"'{}' not found in keyspace '{}'\".format(name, ks))\n\n    def get_trigger_names(self, ksname=None):\n        if ksname is None:\n            ksname = self.current_keyspace\n\n        return [trigger.name\n                for table in list(self.get_keyspace_meta(ksname).tables.values())\n                for trigger in list(table.triggers.values())]\n\n    def reset_statement(self):\n        self.reset_prompt()\n        self.statement.truncate(0)\n        self.statement.seek(0)\n        self.empty_lines = 0\n\n    def reset_prompt(self):\n        if self.current_keyspace is None:\n            self.set_prompt(self.default_prompt, True)","sourceCodeStart":617,"sourceCodeEnd":653,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/pylib/cqlshlib/cqlshmain.py#L617-L653","documentation":"Shell.get_object_meta falls through to ObjectNotFound when the given name matches no table, index, or view in the resolved keyspace (it already checked keyspaces first). This is the generic 'object does not exist in this keyspace' terminal error of the lookup.","triggerScenarios":"get_object_meta(ks, name) where name is not a key in ksmeta.tables, ksmeta.indexes, nor ksmeta.views (and not the keyspace itself). E.g. DESCRIBE <badname>, or programmatic resolution of an identifier before parsing.","commonSituations":"Typos in table/index/view names; referring to a table without the keyspace while the wrong keyspace is in scope; object dropped by another client; identifier case-sensitivity problems.","solutions":["Verify the exact object name with DESCRIBE KEYSPACE <ks>.","Prefix the object with its keyspace (ks.object) or USE the correct keyspace first.","Refresh schema metadata / reconnect if the object was just created.","Check name casing — unquoted identifiers are lowercased in CQL."],"exampleFix":"// before\nshell.get_object_meta('ks', 'User')  # ObjectNotFound (case-sensitive after quoting)\n// after\nshell.get_object_meta('ks', 'user')  # unquoted identifiers are lowercase","handlingStrategy":"try-catch","validationCode":"ksmeta = shell.get_keyspace_meta(ks)\nfound = name in ksmeta.tables or name in ksmeta.indexes or name in ksmeta.views\nif not found:\n    raise LookupError(f\"{name!r} not a table/index/view in {ks}\")","typeGuard":"def object_exists(shell, ks, name):\n    m = shell.get_keyspace_meta(ks)\n    return name in m.tables or name in m.indexes or name in m.views","tryCatchPattern":"try:\n    obj = shell.get_object_meta(ks, name)\nexcept ObjectNotFound:\n    obj = None  # list valid objects for the user","preventionTips":["Keyspace-qualify identifiers; do not rely on current keyspace.","Unquoted CQL identifiers are lowercased — quote or lowercase names.","After DDL, refresh metadata before resolving objects."],"tags":["cassandra","cqlsh","object-lookup","schema-metadata","not-found"],"backgroundTag":"entity-not-found","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}