hibernate/hibernate-orm · error · HibernateException
Produced proxy does not correctly implement HibernateProxy
Error message
Produced proxy does not correctly implement HibernateProxy
What it means
Deserialization guard in ByteBuddyProxyHelper.deserializeProxy: after rebuilding the proxy class and installing the interceptor, the instance cannot be narrowed to HibernateProxy (asHibernateProxy() null), so it cannot be returned as a lazy proxy. Signals a proxy-class construction defect during deserialization rather than a user input error.
Solutions
- Ensure proxy generation is not intercepted by other agents or shade plugins.
- Align Hibernate/ByteBuddy versions.
Defensive patterns
Strategy: validation
When it happens
Trigger: A runtime precondition of the Hibernate API is violated.
Common situations: Occurs when application code or configuration does not satisfy the documented contract of the API being called.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/cb771a5cbfa519c6.
Report an issue: GitHub.
Appendix: source
Thrown at hibernate-core/src/main/java/org/hibernate/proxy/pojo/bytebuddy/ByteBuddyProxyHelper.java:124
resolveIdGetterMethod( proxy ),
resolveIdSetterMethod( proxy ),
proxy.getComponentIdType(),
null,
overridesEquals( proxy.getPersistentClass() )
);
// note: interface is assumed to already contain HibernateProxy.class
try {
final var proxyClass = buildProxy( proxy.getPersistentClass(), proxy.getInterfaces() );
final var instance = (PrimeAmongSecondarySupertypes) proxyClass.getDeclaredConstructor().newInstance();
final var proxyConfiguration = instance.asProxyConfiguration();
if ( proxyConfiguration == null ) {
throw new HibernateException( "Produced proxy does not correctly implement ProxyConfiguration" );
}
proxyConfiguration.$$_hibernate_set_interceptor( interceptor );
final var hibernateProxy = instance.asHibernateProxy();
if ( hibernateProxy == null ) {
throw new HibernateException( "Produced proxy does not correctly implement HibernateProxy" );
}
return hibernateProxy;
}
catch (Throwable t) {
throw new HibernateException( "Bytecode enhancement failed for entity '"
+ proxy.getEntityName() + "'", t );
}
}
private static Method resolveIdGetterMethod(SerializableProxy serializableProxy) {
if ( serializableProxy.getIdentifierGetterMethodName() == null ) {
return null;
}
try {
return serializableProxy.getIdentifierGetterMethodClass()
.getDeclaredMethod( serializableProxy.getIdentifierGetterMethodName() );
}View on GitHub (pinned to fad1729dce)