{"record":{"id":"04418fd0b643a87a","repo":"apache/cassandra","slug":"column-family-not-found","errorCode":null,"errorMessage":"Column family {} not found","messagePattern":"Column family (.+?) not found","errorType":"exception","errorClass":"ColumnFamilyNotFound","httpStatus":null,"severity":"error","filePath":"pylib/cqlshlib/cqlshmain.py","lineNumber":566,"sourceCode":"\n        raise KeyspaceNotFound('Keyspace %r not found.' % ksname)\n\n    def get_keyspaces(self):\n        return list(self.conn.metadata.keyspaces.values())\n\n    def get_ring(self, ks):\n        self.conn.metadata.token_map.rebuild_keyspace(ks, build_if_absent=True)\n        return self.conn.metadata.token_map.tokens_to_hosts_by_ks[ks]\n\n    def get_table_meta(self, ksname, tablename):\n        if ksname is None:\n            ksname = self.current_keyspace\n        ksmeta = self.get_keyspace_meta(ksname)\n        if tablename not in ksmeta.tables:\n            if ksname == 'system_auth' and tablename in ['roles', 'role_permissions', 'generated_values']:\n                self.get_fake_auth_table_meta(ksname, tablename)\n            else:\n                raise ColumnFamilyNotFound(\"Column family {} not found\".format(tablename))\n        else:\n            return ksmeta.tables[tablename]\n\n    def get_fake_auth_table_meta(self, ksname, tablename):\n        # may be using external auth implementation so internal tables\n        # aren't actually defined in schema. In this case, we'll fake\n        # them up\n        if tablename == 'roles':\n            ks_meta = KeyspaceMetadata(ksname, True, None, None)\n            table_meta = TableMetadata(ks_meta, 'roles')\n            table_meta.columns['role'] = ColumnMetadata(table_meta, 'role', cassandra.cqltypes.UTF8Type)\n            table_meta.columns['is_superuser'] = ColumnMetadata(table_meta, 'is_superuser', cassandra.cqltypes.BooleanType)\n            table_meta.columns['can_login'] = ColumnMetadata(table_meta, 'can_login', cassandra.cqltypes.BooleanType)\n        elif tablename == 'role_permissions':\n            ks_meta = KeyspaceMetadata(ksname, True, None, None)\n            table_meta = TableMetadata(ks_meta, 'role_permissions')\n            table_meta.columns['role'] = ColumnMetadata(table_meta, 'role', cassandra.cqltypes.UTF8Type)\n            table_meta.columns['resource'] = ColumnMetadata(table_meta, 'resource', cassandra.cqltypes.UTF8Type)","sourceCodeStart":548,"sourceCodeEnd":584,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/pylib/cqlshlib/cqlshmain.py#L548-L584","documentation":"Shell.get_table_meta looks up a table in KeyspaceMetadata.tables. If the table is missing and it is not one of the faked system_auth tables (roles, role_permissions, generated_values), it raises ColumnFamilyNotFound. In cqlsh 'column family' and 'table' are synonyms inherited from the Cassandra/Thrift era.","triggerScenarios":"get_table_meta(ksname, tablename) called (directly or via get_column_names, parse_for_select_meta, parse_for_update_meta, perform_simple_statement) with a tablename absent from ksmeta.tables and ksname not being system_auth with a faked table.","commonSituations":"Typo in a table name in a COPY/DESCRIBE/SELECT path; querying a table that exists in a different keyspace; the table was dropped by another client mid-session; stale driver metadata after CREATE TABLE.","solutions":["Verify with DESCRIBE TABLES in the keyspace and correct the table name.","Qualify the table with the right keyspace (ks.tablename).","Refresh schema metadata / reconnect if the table was just created.","Create the missing table with CREATE TABLE if it does not exist."],"exampleFix":"// before\nshell.get_table_meta('ks', 'usser')  # ColumnFamilyNotFound\n// after\nshell.get_table_meta('ks', 'users')  # correct table name","handlingStrategy":"validation","validationCode":"ksmeta = shell.get_keyspace_meta(ksname)\nif tablename not in ksmeta.tables:\n    raise LookupError(f\"Table {tablename} missing in {ksname}\")","typeGuard":"def table_exists(shell, ksname, tablename):\n    return tablename in shell.get_keyspace_meta(ksname).tables","tryCatchPattern":"try:\n    tmeta = shell.get_table_meta(ksname, tablename)\nexcept ColumnFamilyNotFound:\n    tmeta = None  # fall back to re-describing keyspace","preventionTips":["Keyspace-qualify table references.","Match casing: unquoted CQL identifiers are lowercase.","Refresh schema metadata after CREATE/DROP TABLE.","Confirm table names with DESCRIBE TABLES."],"tags":["cassandra","cqlsh","table","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"}