hibernate/hibernate-orm · error · IllegalStateException
Re-entrant enhancement is not supported: {className}
Error message
Re-entrant enhancement is not supported: {className} What it means
Error "Re-entrant enhancement is not supported: {className}" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/bytecode/enhance/internal/bytebuddy/ModelTypePool.java:92
*
* @param classFileLocator
* @param coreTypePool
* @param cacheProvider
* @return
*/
static EnhancerClassLocator buildModelTypePool(ClassFileLocator classFileLocator, CoreTypePool coreTypePool, EnhancerCacheProvider cacheProvider) {
Objects.requireNonNull( classFileLocator );
Objects.requireNonNull( coreTypePool );
Objects.requireNonNull( cacheProvider );
return new ModelTypePool( cacheProvider,
new EnhancerClassFileLocator( cacheProvider, classFileLocator ), coreTypePool );
}
@Override
public void registerClassNameAndBytes(final String className, final byte[] bytes) {
final var currentEnhancementState = poolCache.getEnhancementState();
if ( currentEnhancementState != null ) {
throw new IllegalStateException( "Re-entrant enhancement is not supported: " + className );
}
final var state =
new EnhancerCacheProvider.EnhancementState( className,
new ClassFileLocator.Resolution.Explicit( Objects.requireNonNull( bytes ) ) );
// Set the state first because the ClassFileLocator needs this in the doDescribe() call below
poolCache.setEnhancementState( state );
state.setTypePoolResolution( doDescribe( className ) );
}
@Override
public void deregisterClassNameAndBytes(String className) {
poolCache.removeEnhancementState();
}
@Override
public ClassFileLocator asClassFileLocator() {
return locator;
}View on GitHub (pinned to fad1729dce)
Solutions
- Avoid triggering enhancement of a class from within its own enhancement; check for circular class-loading during the enhancement run.
Example fix
Avoid triggering enhancement of a class from within its own enhancement; check for circular class-loading during the enhancement run.
When it happens
Trigger: Bytecode enhancement, proxy creation, or lazy interception is applied to an incompatible class or configuration.
Common situations: Build-time enhancement with module-system restrictions, mismatched Hibernate versions between build and runtime, or hibernate.bytecode.provider=none with a model that needs proxies.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/eac6069aa99d7501.
Report an issue: GitHub.