{"record":{"id":"63614b4e346bfe4f","repo":"apache/cassandra","slug":"user-type-r-not-found","errorCode":null,"errorMessage":"User type {!r} not found","messagePattern":"User type (.+?) not found","errorType":"exception","errorClass":"UserTypeNotFound","httpStatus":null,"severity":"error","filePath":"pylib/cqlshlib/cqlshmain.py","lineNumber":523,"sourceCode":"        layout = self.get_table_meta(ksname, cfname)\n        return list(layout.columns)\n\n    def get_usertype_names(self, ksname=None):\n        if ksname is None:\n            ksname = self.current_keyspace\n\n        return list(self.get_keyspace_meta(ksname).user_types)\n\n    def get_usertype_layout(self, ksname, typename):\n        if ksname is None:\n            ksname = self.current_keyspace\n\n        ks_meta = self.get_keyspace_meta(ksname)\n\n        try:\n            user_type = ks_meta.user_types[typename]\n        except KeyError:\n            raise UserTypeNotFound(\"User type {!r} not found\".format(typename))\n\n        return list(zip(user_type.field_names, user_type.field_types))\n\n    def get_userfunction_names(self, ksname=None):\n        if ksname is None:\n            ksname = self.current_keyspace\n\n        return [f.name for f in list(self.get_keyspace_meta(ksname).functions.values())]\n\n    def get_useraggregate_names(self, ksname=None):\n        if ksname is None:\n            ksname = self.current_keyspace\n\n        return [f.name for f in list(self.get_keyspace_meta(ksname).aggregates.values())]\n\n    def get_cluster_name(self):\n        return self.conn.metadata.cluster_name\n","sourceCodeStart":505,"sourceCodeEnd":541,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/pylib/cqlshlib/cqlshmain.py#L505-L541","documentation":"cqlsh's Shell.get_usertype_layout looks up a user-defined type (UDT) by name in the keyspace's driver metadata (ks_meta.user_types). If the name is absent, it raises UserTypeNotFound. This means the requested UDT does not exist in that keyspace's schema as known by the connected cluster.","triggerScenarios":"Calling get_usertype_layout(ksname, typename) where typename is not a key in KeyspaceMetadata.user_types — e.g. a typo'd UDT name, a UDT that exists in a different keyspace, or the driver's schema metadata is stale after a CREATE/DROP TYPE.","commonSituations":"DESCRIBE TYPE or formatting of query results referencing a UDT after the type was dropped; connecting to a cluster where the type was only created in another keyspace; schema disagreement after a DDL change so the driver hasn't fetched the new type yet.","solutions":["Verify the UDT exists: run DESCRIBE KEYSPACE <ks> (or check ks_meta.user_types) and correct the type name spelling.","Qualify the UDT with the correct keyspace (types are keyspace-scoped).","Reconnect or refresh schema metadata so the driver picks up newly created types.","Create the missing type with CREATE TYPE if it genuinely does not exist."],"exampleFix":"// before\nshell.get_usertype_layout('ks', 'Adress')  # UserTypeNotFound\n// after\nshell.get_usertype_layout('ks', 'Address')  # match exact UDT name","handlingStrategy":"try-catch","validationCode":"ks_meta = shell.get_keyspace_meta(ksname)\nif typename not in ks_meta.user_types:\n    raise LookupError(f\"UDT {typename!r} missing in {ksname}\")","typeGuard":"def has_udt(shell, ksname, typename):\n    return typename in shell.get_keyspace_meta(ksname).user_types","tryCatchPattern":"try:\n    fields = shell.get_usertype_layout(ksname, typename)\nexcept UserTypeNotFound:\n    fields = []  # or fall back to re-fetching schema metadata","preventionTips":["Always keyspace-qualify UDT references.","After DDL (CREATE/DROP TYPE), refresh schema metadata before lookups.","List available types with DESCRIBE KEYSPACE before referencing one."],"tags":["cassandra","cqlsh","udt","schema-metadata","not-found"],"backgroundTag":"resource-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"}