{"record":{"id":"ce6ebd6e3c6e347e","repo":"hibernate/hibernate-orm","slug":"attempted-to-overwrite-registration-s-for-type","errorCode":null,"errorMessage":"Attempted to overwrite registration [%s] for type definition.","messagePattern":"Attempted to overwrite registration \\[(.+?)\\] for type definition\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/internal/TypeDefinitionRegistryStandardImpl.java","lineNumber":103,"sourceCode":"\t\t}\n\n\t\treturn this;\n\t}\n\n\tprivate void register(String name, TypeDefinition typeDefinition, DuplicationStrategy duplicationStrategy) {\n\t\tif ( duplicationStrategy == DuplicationStrategy.KEEP ) {\n\t\t\tif ( !typeDefinitionMap.containsKey( name ) ) {\n\t\t\t\ttypeDefinitionMap.put( name, typeDefinition );\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tfinal var existing = typeDefinitionMap.put( name, typeDefinition );\n\t\t\tif ( existing != null && existing != typeDefinition ) {\n\t\t\t\tif ( duplicationStrategy == DuplicationStrategy.OVERWRITE ) {\n\t\t\t\t\tBOOT_LOGGER.overwroteExistingRegistrationForTypeDefinition( name );\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\t\t\tString.format(\n\t\t\t\t\t\t\t\t\tLocale.ROOT,\n\t\t\t\t\t\t\t\t\t\"Attempted to overwrite registration [%s] for type definition.\",\n\t\t\t\t\t\t\t\t\tname\n\t\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t@Override\n\tpublic Map<String, TypeDefinition> copyRegistrationMap() {\n\t\treturn new HashMap<>( typeDefinitionMap );\n\t}\n}\n","sourceCodeStart":85,"sourceCodeEnd":120,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/internal/TypeDefinitionRegistryStandardImpl.java#L85-L120","documentation":"Error \"Attempted to overwrite registration [%s] for type definition.\" thrown in hibernate/hibernate-orm.","triggerScenarios":"A runtime precondition of the Hibernate API is violated.","commonSituations":"Occurs when application code or configuration does not satisfy the documented contract of the API being called.","solutions":["Avoid registering the same type definition name twice; check for duplicate @TypeDef/@JavaTypeRegistration annotations or repeated programmatic registration.","If override is intended, use the registry method that explicitly allows overwriting, or unregister the old one first.","Check that the same configuration is not applied twice (e.g. both hbm.xml and annotations)."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}