{"record":{"id":"a49cd5dd9481e2e7","repo":"hibernate/hibernate-orm","slug":"bytecode-enhancement-failed-for-entity","errorCode":null,"errorMessage":"Bytecode enhancement failed for entity '{}'","messagePattern":"Bytecode enhancement failed for entity '(.+?)'","errorType":"exception","errorClass":"HibernateException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/proxy/pojo/bytebuddy/ByteBuddyProxyFactory.java","lineNumber":111,"sourceCode":"\t}\n\n\t/**\n\t * This technically returns a HibernateProxy, but declaring that type as the return\n\t * type for the newInstance() action triggers an implicit case of type pollution.\n\t * We therefore declare it as PrimeAmongSecondarySupertypes, and require the\n\t * invoker to perform the narrowing\n\t */\n\tprivate PrimeAmongSecondarySupertypes getHibernateProxyInternal() throws HibernateException {\n\t\ttry {\n\t\t\treturn (PrimeAmongSecondarySupertypes) proxyClass.getConstructor().newInstance();\n\t\t}\n\t\tcatch (NoSuchMethodException e) {\n\t\t\tthrow new HibernateException(\n\t\t\t\t\t\"Bytecode enhancement failed because no public, protected or package-private default constructor was found for entity '\"\n\t\t\t\t\t\t\t+ entityName + \"' (private constructors don't work with runtime proxies)\", e );\n\t\t}\n\t\tcatch (Throwable t) {\n\t\t\tthrow new HibernateException( \"Bytecode enhancement failed for entity '\" + entityName + \"'\", t );\n\t\t}\n\t}\n\n}\n","sourceCodeStart":93,"sourceCodeEnd":116,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/proxy/pojo/bytebuddy/ByteBuddyProxyFactory.java#L93-L116","documentation":"Error \"Bytecode enhancement failed for entity '{}'\" 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":["Inspect the cause of the ByteBuddy enhancement failure.","Simplify the entity hierarchy or align bytecode library versions."],"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"}