{"record":{"id":"7a33713b98a392b1","repo":"quarkusio/quarkus","slug":"quarkus-currently-only-supports-using-a-single-cac","errorCode":null,"errorMessage":"Quarkus currently only supports using a single cache name. Offending %s is %s","messagePattern":"Quarkus currently only supports using a single cache name\\. Offending (.+?) is (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions/spring-cache/deployment/src/main/java/io/quarkus/spring/cache/SpringCacheUtil.java","lineNumber":42,"sourceCode":"        if (cacheName == null || cacheName.isEmpty()) {\n            AnnotationValue value = annotationInstance.value();\n            if (value != null) {\n                cacheName = singleName(value, annotationInstance.target());\n            }\n        }\n        return (cacheName == null || cacheName.isEmpty()) ? Optional.empty() : Optional.of(cacheName);\n    }\n\n    private static String singleName(AnnotationValue annotationValue, AnnotationTarget target) {\n        if (annotationValue.kind() != AnnotationValue.Kind.ARRAY) { // shouldn't happen\n            return null;\n        }\n\n        String[] strings = annotationValue.asStringArray();\n        if (strings.length == 0) {\n            return null;\n        } else if (strings.length > 1) {\n            throw new IllegalArgumentException(\n                    String.format(\"Quarkus currently only supports using a single cache name. Offending %s is %s\",\n                            target.kind() == AnnotationTarget.Kind.METHOD ? \"method\" : \"class\", target.toString()));\n        }\n        return strings[0];\n    }\n}\n","sourceCodeStart":24,"sourceCodeEnd":49,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/spring-cache/deployment/src/main/java/io/quarkus/spring/cache/SpringCacheUtil.java#L24-L49","documentation":"Spring allows @Cacheable(value = {\"a\", \"b\"}) to store results in several caches, but Quarkus's Spring Cache extension resolves exactly one cache name per annotation. SpringCacheUtil.singleName() reads the string-array value and throws if more than one name is supplied. This keeps the mapping to a single underlying Quarkus cache simple.","triggerScenarios":"Annotating a method with multiple cache names, e.g. @Cacheable({\"cache1\", \"cache2\"}) or multiple values in @CacheEvict; getSpringCacheName() calls singleName() during deployment and fails.","commonSituations":"Porting Spring code that used multi-cache eviction to invalidate several caches at once; splitting entries across a primary and a near cache.","solutions":["Reduce the annotation to a single cache name","If several caches must be invalidated, add separate @CacheEvict annotations or use the native Quarkus @CacheInvalidateAll annotations (they compose)","Declare the additional caches via application code instead of annotations"],"exampleFix":"// before\n@CacheEvict({\"items\", \"itemDetails\"})\npublic void update(Item i) { ... }\n\n// after\n@CacheEvict(\"items\")\npublic void update(Item i) { ... }","handlingStrategy":"validation","validationCode":"@Cacheable(\"items\")           // single name: OK\n// @Cacheable({\"a\",\"b\"})      // NOT supported\npublic Item find(long id) { ... }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass exactly one cache name","Use multiple @CacheInvalidateAll/@CacheEvict-style annotations when multiple caches must be affected","Keep a porting checklist when migrating from Spring"],"tags":["quarkus","spring-cache","multiple-cache-names","build-time"],"backgroundTag":"unsupported-multiple-cache-names","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"}