hibernate/hibernate-orm · error · IllegalStateException

Cache provider not started

Error message

Cache provider not started

What it means

Guard on AbstractRegionFactory: a cache region operation was invoked before start() completed (or after a failed start, in which case the original starting exception is attached). Means the RegionFactory is being used outside its started lifecycle window.

Solutions

  1. Do not use cache regions before the SessionFactory is fully built; the RegionFactory starts with the SessionFactory.

Example fix

Do not use cache regions before the SessionFactory is fully built; the RegionFactory starts with the SessionFactory.
Defensive patterns

Strategy: validation

When it happens

Trigger: Second-level caching is misconfigured or a cache region/key does not match what Hibernate expects.

Common situations: Enabling @Cacheable entities without setting hibernate.cache.region.factory_class, custom RegionFactory implementations, or unwrapping Cache to provider types.


AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22). Data as JSON: /api/errors/68dfbe4e47f8fe32. Report an issue: GitHub.

Appendix: source

Thrown at hibernate-core/src/main/java/org/hibernate/cache/spi/AbstractRegionFactory.java:55

	 */
	public static final List<String> LEGACY_UPDATE_TIMESTAMPS_REGION_UNQUALIFIED_NAMES = List.of(
			"org.hibernate.cache.spi.TimestampsRegion",
			"org.hibernate.cache.spi.UpdateTimestampsCache"
	);

	private Exception startingException;

	private SessionFactoryOptions options;


	protected boolean isStarted() {
		if ( started.get() ) {
			assert options != null;
			return true;
		}
		else {
			assert options == null;
			throw new IllegalStateException( "Cache provider not started", startingException );
		}
	}

	protected void verifyStarted() {
		if ( ! verifiedStartStatus() ) {
			throw new IllegalStateException( "Cache provider not started", startingException );
		}
	}

	protected boolean verifiedStartStatus() {
		if ( started.get() ) {
			assert options != null;
			return true;
		}
		else {
			assert options == null;
			return false;
		}

View on GitHub (pinned to fad1729dce)