{"record":{"id":"299e7ad6b2528889","repo":"quarkusio/quarkus","slug":"cache-cannot-be-used-without-the-quarkus-cache","errorCode":null,"errorMessage":"#cache cannot be used without the 'quarkus-cache' extension","messagePattern":"#cache cannot be used without the 'quarkus-cache' extension","errorType":"exception","errorClass":"java.lang.IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions/qute/runtime/src/main/java/io/quarkus/qute/runtime/cache/MissingCacheConfigurator.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 MissingCacheConfigurator {\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 cannot be used without the 'quarkus-cache' extension\");\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/MissingCacheConfigurator.java#L1-L25","documentation":"When the quarkus-cache extension is absent, Qute registers a placeholder #cache section helper whose getValue always throws this IllegalStateException. This fails fast when a template uses {#cache} but no cache implementation is available at runtime.","triggerScenarios":"Rendering a template containing a {#cache} section while the application does not include the quarkus-cache dependency.","commonSituations":"Copying templates that use {#cache} into a project without quarkus-cache; the cache extension was removed during dependency cleanup; conditional usage of #cache in a shared template library.","solutions":["Add the quarkus-cache extension: io.quarkus:quarkus-cache.","Remove the {#cache} section from the template if caching is not needed.","Guard template sharing so cached fragments are only used in apps with quarkus-cache."],"exampleFix":"// before (pom.xml): no cache extension\n// after\n<dependency>\n  <groupId>io.quarkus</groupId>\n  <artifactId>quarkus-cache</artifactId>\n</dependency>","handlingStrategy":"validation","validationCode":"boolean hasCache = Class.forName(\"io.quarkus.cache.CacheManager\", false, getClass().getClassLoader()) != null;\nif (!hasCache && templateUsesCacheSection) throw new IllegalStateException(\"Add quarkus-cache for {#cache}\");","typeGuard":null,"tryCatchPattern":"try { render(template); } catch (IllegalStateException e) { if (e.getMessage().contains(\"quarkus-cache\")) { /* add dependency or drop {#cache} */ } else throw e; }","preventionTips":["Add io.quarkus:quarkus-cache whenever templates use {#cache}","Document the extension requirement in shared template libraries","Run a startup test that renders cached templates"],"tags":["qute","cache","missing-dependency","templates"],"backgroundTag":"missing-extension-dependency","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}