{"record":{"id":"c528eac439a8c232","repo":"quarkusio/quarkus","slug":"cache-is-not-supported-for-remote-caches","errorCode":null,"errorMessage":"#cache is not supported for remote caches","messagePattern":"#cache is not supported for remote caches","errorType":"exception","errorClass":"java.lang.IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions/qute/runtime/src/main/java/io/quarkus/qute/runtime/cache/UnsupportedRemoteCacheConfigurator.java","lineNumber":19,"sourceCode":"package io.quarkus.qute.runtime.cache;\n\nimport java.util.concurrent.CompletionStage;\nimport java.util.function.Function;\n\nimport jakarta.enterprise.event.Observes;\n\nimport io.quarkus.qute.CacheSectionHelper;\nimport io.quarkus.qute.EngineBuilder;\nimport io.quarkus.qute.ResultNode;\n\npublic class UnsupportedRemoteCacheConfigurator {\n\n    void configureEngine(@Observes EngineBuilder builder) {\n        builder.addSectionHelper(new CacheSectionHelper.Factory(new CacheSectionHelper.Cache() {\n\n            @Override\n            public CompletionStage<ResultNode> getValue(String key, Function<String, CompletionStage<ResultNode>> loader) {\n                throw new IllegalStateException(\"#cache is not supported for remote caches\");\n            }\n        }));\n    }\n\n}\n","sourceCodeStart":1,"sourceCodeEnd":25,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/qute/runtime/src/main/java/io/quarkus/qute/runtime/cache/UnsupportedRemoteCacheConfigurator.java#L1-L25","documentation":"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.","triggerScenarios":"Using {#cache} in a template while quarkus-cache is configured with a remote cache type (quarkus.cache.type=infinispan-remote).","commonSituations":"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.","solutions":["Configure a local cache: quarkus.cache.type=caffeine (default) for template caching.","Remove {#cache} sections from templates and cache rendered data at the application layer instead.","Use a separate local cache dedicated to Qute while keeping the remote cache for app data if both are needed."],"exampleFix":"// before\nquarkus.cache.type=infinispan-remote\n// after\nquarkus.cache.type=caffeine","handlingStrategy":"validation","validationCode":"if (\"infinispan-remote\".equals(config.getValue(\"quarkus.cache.type\", String.class, \"caffeine\"))) {\n    throw new IllegalStateException(\"#cache needs a local (caffeine) cache\");\n}","typeGuard":null,"tryCatchPattern":"try { render(template); } catch (IllegalStateException e) { if (e.getMessage().contains(\"remote caches\")) { /* switch cache type or remove {#cache} */ } else throw e; }","preventionTips":["Keep template caching on caffeine; use remote caches only for app data","Review cache type changes for #cache template usage","Add an integration test rendering cached templates with your cache config"],"tags":["qute","cache","configuration","infinispan"],"backgroundTag":"unsupported-cache-type","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}