quarkusio/quarkus · error · java.lang.IllegalStateException

#cache is not supported for remote caches

Error message

#cache is not supported for remote caches

What it means

When the configured cache is a remote cache (e.g. remote Infinispan), Qute registers a placeholder #cache helper that throws this IllegalStateException, because remote caches are not supported by the #cache section which requires a local Caffeine-backed cache.

Source

Thrown at extensions/qute/runtime/src/main/java/io/quarkus/qute/runtime/cache/UnsupportedRemoteCacheConfigurator.java:19

package io.quarkus.qute.runtime.cache;

import java.util.concurrent.CompletionStage;
import java.util.function.Function;

import jakarta.enterprise.event.Observes;

import io.quarkus.qute.CacheSectionHelper;
import io.quarkus.qute.EngineBuilder;
import io.quarkus.qute.ResultNode;

public class UnsupportedRemoteCacheConfigurator {

    void configureEngine(@Observes EngineBuilder builder) {
        builder.addSectionHelper(new CacheSectionHelper.Factory(new CacheSectionHelper.Cache() {

            @Override
            public CompletionStage<ResultNode> getValue(String key, Function<String, CompletionStage<ResultNode>> loader) {
                throw new IllegalStateException("#cache is not supported for remote caches");
            }
        }));
    }

}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Configure a local cache: quarkus.cache.type=caffeine (default) for template caching.
  2. Remove {#cache} sections from templates and cache rendered data at the application layer instead.
  3. Use a separate local cache dedicated to Qute while keeping the remote cache for app data if both are needed.

Example fix

// before
quarkus.cache.type=infinispan-remote
// after
quarkus.cache.type=caffeine
Defensive patterns

Strategy: validation

Validate before calling

if ("infinispan-remote".equals(config.getValue("quarkus.cache.type", String.class, "caffeine"))) {
    throw new IllegalStateException("#cache needs a local (caffeine) cache");
}

Try / catch

try { render(template); } catch (IllegalStateException e) { if (e.getMessage().contains("remote caches")) { /* switch cache type or remove {#cache} */ } else throw e; }

Prevention

When it happens

Trigger: Using {#cache} in a template while quarkus-cache is configured with a remote cache type (quarkus.cache.type=infinispan-remote).

Common situations: Apps using remote Infinispan caches for application data that also rely on template {#cache}; switching the cache type to remote and unknowingly breaking template caching.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/c528eac439a8c232. Report an issue: GitHub.