{"record":{"id":"215c043dadb9873f","repo":"quarkusio/quarkus","slug":"annotation-instance-on-instance-target","errorCode":null,"errorMessage":"Annotation '${instance}' on '${instance.target()}' contains the following currently unsupported annotation values: ${unsupportedValues}","messagePattern":"Annotation '(.+?)' on '(.+?)' contains the following currently unsupported annotation values: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions/spring-cache/deployment/src/main/java/io/quarkus/spring/cache/SpringCacheProcessor.java","lineNumber":87,"sourceCode":"        }\n        return result;\n    }\n\n    private void validateUsage(AnnotationInstance instance) {\n        if (instance.target().kind() != AnnotationTarget.Kind.METHOD) {\n            throw new IllegalArgumentException(\n                    \"Currently Spring Cache annotations can only be added to methods. Offending instance is annotation '\"\n                            + instance + \"' on \" + instance.target() + \"'\");\n        }\n        List<AnnotationValue> values = instance.values();\n        List<String> unsupportedValues = new ArrayList<>();\n        for (AnnotationValue value : values) {\n            if (CURRENTLY_UNSUPPORTED_ANNOTATION_VALUES.contains(value.name())) {\n                unsupportedValues.add(value.name());\n            }\n        }\n        if (!unsupportedValues.isEmpty()) {\n            throw new IllegalArgumentException(\"Annotation '\" +\n                    instance + \"' on '\" + instance.target()\n                    + \"' contains the following currently unsupported annotation values: \"\n                    + String.join(\", \", unsupportedValues));\n        }\n    }\n\n}\n","sourceCodeStart":69,"sourceCodeEnd":95,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/spring-cache/deployment/src/main/java/io/quarkus/spring/cache/SpringCacheProcessor.java#L69-L95","documentation":"The Spring Cache extension supports only a subset of annotation attributes. validateUsage scans the annotation's values against CURRENTLY_UNSUPPORTED_ANNOTATION_VALUES and throws if any unsupported attribute (e.g. 'key', 'condition', 'unless', 'cacheManager') is present. This is a deliberate build-time limitation of the Quarkus implementation rather than Spring semantics.","triggerScenarios":"Using @Cacheable/@CacheEvict/@CachePut with attributes such as key, keyGenerator, condition, unless, or cacheManager in a Quarkus app; the deployment step lists them in the error message.","commonSituations":"Migrating Spring code that customizes cache keys with SpEL ('key=\"#id\"') or conditional caching ('condition=\"#name != null\"'); users unaware Quarkus only supports the cache-names/values basics.","solutions":["Remove the unsupported attributes from the annotation","Rely on Quarkus cache-key defaults (method parameters) or implement a custom cache key via the Caffeine/redis-cache extension instead of SpEL keys","Move conditional logic (formerly 'condition'/'unless') into the method body"],"exampleFix":"// before\n@Cacheable(value = \"items\", key = \"#id\", unless = \"#result == null\")\npublic Item find(long id) { ... }\n\n// after\n@Cacheable(\"items\")\npublic Item find(long id) { ... }","handlingStrategy":"validation","validationCode":"Set<String> unsupported = Set.of(\"key\", \"keyGenerator\", \"condition\", \"unless\", \"cacheManager\");\nfor (Annotation ann : method.getAnnotations()) {\n    // fail fast in a startup listener if unsupported attributes are used\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use only value/cacheNames with the Spring Cache extension in Quarkus","Implement custom keys via the native Quarkus caching annotations instead of SpEL","Review the compatibility table in the Quarkus Spring Cache docs"],"tags":["quarkus","spring-cache","unsupported-attribute","build-time"],"backgroundTag":"unsupported-annotation-attribute","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"}