hibernate/hibernate-orm · error · IllegalStateException

Found multiple BytecodeProvider service registrations…

Error message

Found multiple BytecodeProvider service registrations, cannot determine which one to use

What it means

Service discovery found more than one BytecodeProvider on the classpath, so Hibernate cannot pick one deterministically. Usually caused by conflicting bytecode provider jars; keep exactly one provider or select one explicitly via the 'hibernate.bytecode.provider' setting.

Solutions

  1. Keep only one bytecode provider on the classpath (bytebuddy or none); remove the conflicting hibernate-bytecode provider dependency.

Example fix

Keep only one bytecode provider on the classpath (bytebuddy or none); remove the conflicting hibernate-bytecode provider dependency.
Defensive patterns

Strategy: validation

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/c81c0faee77858a8. Report an issue: GitHub.

Appendix: source

Thrown at hibernate-core/src/main/java/org/hibernate/bytecode/internal/BytecodeProviderInitiator.java:68

		return getBytecodeProvider( ServiceLoader.load(
				BytecodeProvider.class,
				BytecodeProvider.class.getClassLoader()
		) );
	}

	@Internal
	@Nonnull
	public static BytecodeProvider getBytecodeProvider(@Nonnull Iterable<BytecodeProvider> bytecodeProviders) {
		final var iterator = bytecodeProviders.iterator();
		if ( !iterator.hasNext() ) {
			// If no BytecodeProvider service is available,
			// default to the "no-op" enhancer
			return new BytecodeProviderImpl();
		}
		else {
			final var provider = iterator.next();
			if ( iterator.hasNext() ) {
				throw new IllegalStateException(
						"Found multiple BytecodeProvider service registrations, cannot determine which one to use" );
			}
			return provider;
		}
	}
}

View on GitHub (pinned to fad1729dce)