{"record":{"id":"def317780f642f25","repo":"apache/cassandra","slug":"cannot-resolve-udts-for-keyspace-s-some-types-ar","errorCode":null,"errorMessage":"Cannot resolve UDTs for keyspace %s: some types are missing","messagePattern":"Cannot resolve UDTs for keyspace (.+?): some types are missing","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/schema/Types.java","lineNumber":378,"sourceCode":"            for (Map.Entry<RawUDT, Integer> entry : vertices.entrySet())\n                if (entry.getValue() == 0)\n                    resolvableTypes.add(entry.getKey());\n\n            Types types = new Types(new HashMap<>());\n            while (!resolvableTypes.isEmpty())\n            {\n                RawUDT vertex = resolvableTypes.remove();\n\n                for (RawUDT dependentType : adjacencyList.get(vertex))\n                    if (vertices.replace(dependentType, vertices.get(dependentType) - 1) == 1)\n                        resolvableTypes.add(dependentType);\n\n                UserType udt = vertex.prepare(keyspace, types);\n                types.types.put(udt.name, udt);\n            }\n\n            if (types.types.size() != definitions.size())\n                throw new ConfigurationException(format(\"Cannot resolve UDTs for keyspace %s: some types are missing\", keyspace));\n\n            /*\n             * return an immutable copy\n             */\n            return Types.builder().add(types).build();\n        }\n\n        public void add(String name, List<String> fieldNames, List<String> fieldTypes)\n        {\n            add(name, fieldNames, fieldTypes, EMPTY_COMMENT, EMPTY_SECURITY_LABEL, EMPTY_FIELD_COMMENTS, EMPTY_FIELD_SECURITY_LABELS);\n        }\n\n        public void add(String name, List<String> fieldNames, List<String> fieldTypes, String comment, String securityLabel)\n        {\n            add(name, fieldNames, fieldTypes, comment, securityLabel, EMPTY_FIELD_COMMENTS, EMPTY_FIELD_SECURITY_LABELS);\n        }\n\n        public void add(String name,","sourceCodeStart":360,"sourceCodeEnd":396,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/schema/Types.java#L360-L396","documentation":"Thrown as a ConfigurationException when Types.build performs topological resolution of UDT definitions for a keyspace and the resolved set is smaller than the declared definitions, meaning one or more referenced types could not be resolved. This typically means a UDT references another type that is undefined or unresolvable due to a dependency cycle.","triggerScenarios":"Calling Types.build / fetchTypes / deserialize for a keyspace whose stored UDT definitions contain references to missing types or are cyclic, so vertex.prepare cannot resolve every definition and types.types.size() != definitions.size().","commonSituations":"Corrupted or partially-written schema tables after a failed migration; manually editing system_schema.types; restoring a schema snapshot with a subset of UDTs; cross-keyspace copy where dependent types were not migrated together.","solutions":["Inspect system_schema.types for the keyspace and find definitions referencing non-existent types","Drop and recreate the broken UDTs in dependency order (leaf types first)","Restore complete type definitions from a valid schema snapshot","Manually delete the unresolvable rows from system_schema.types (with care) so the keyspace can load"],"exampleFix":"// before (schema contains address -> fullname, but fullname missing)\nCREATE TYPE my_ks.address (street text, person fullname); // fails: Cannot resolve UDTs\n// after\nCREATE TYPE my_ks.fullname (first text, last text);\nCREATE TYPE my_ks.address (street text, person frozen<fullname>);","handlingStrategy":"validation","validationCode":"Set<String> defined = allUdtNames(); for (UserType t : udts) for (String dep : dependenciesOf(t)) if (!defined.contains(dep)) throw new IllegalStateException(\"Missing UDT dependency: \" + dep);","typeGuard":null,"tryCatchPattern":"try { Types t = Types.rawBuilder(ksName).add(definitions).build(); } catch (ConfigurationException e) { /* trigger schema repair / restore full type set */ }","preventionTips":["Migrate UDTs together with their dependent types","Never hand-edit system_schema.types","Verify schema snapshots contain all UDT definitions before restore","Create leaf types before dependents in bootstrap scripts"],"tags":["cassandra","udt","schema"],"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"}