{"record":{"id":"3731d630599ff0e1","repo":"quarkusio/quarkus","slug":"unable-to-determine-the-value-type-for-cachen","errorCode":null,"errorMessage":"Unable to determine the value type for '\" + cacheName + \"' Redis cache. An appropriate configuration value for 'quarkus.cache.redis.\" + cacheName + \".value-type' needs to be set","messagePattern":"Unable to determine the value type for '\" \\+ cacheName \\+ \"' Redis cache\\. An appropriate configuration value for 'quarkus\\.cache\\.redis\\.\" \\+ cacheName \\+ \"\\.value-type' needs to be set","errorType":"exception","errorClass":"DeploymentException","httpStatus":null,"severity":"error","filePath":"extensions/redis-cache/deployment/src/main/java/io/quarkus/cache/redis/deployment/RedisCacheProcessor.java","lineNumber":125,"sourceCode":"            if (cacheSpecificGroup == null) {\n                if (defaultValueType.isPresent()) {\n                    valueType = defaultValueType.get();\n                }\n            } else {\n                if (cacheSpecificGroup.valueType().isPresent()) {\n                    valueType = cacheSpecificGroup.valueType().get();\n                }\n            }\n\n            if (valueType == null && resolvedValuesTypesFromAnnotations.containsKey(cacheName)) {\n                // TODO: does it make sense to use the return type of method annotated with @CacheResult as the last resort or should it override the default cache config?\n                valueType = typeToString(resolvedValuesTypesFromAnnotations.get(cacheName));\n            }\n\n            if (valueType != null) {\n                valueTypes.put(cacheName, TypeParser.parse(valueType));\n            } else {\n                throw new DeploymentException(\"Unable to determine the value type for '\" + cacheName\n                        + \"' Redis cache. An appropriate configuration value for 'quarkus.cache.redis.\" + cacheName\n                        + \".value-type' needs to be set\");\n            }\n        }\n        recorder.setCacheValueTypes(valueTypes);\n    }\n\n    private static boolean isRedisCache(String cacheName, CacheBuildConfig cacheBuildConfig) {\n        CacheBuildConfig.CacheTypeBuildConfig cacheTypeConfig = cacheBuildConfig.cacheTypeByName().get(cacheName);\n        String cacheType = cacheTypeConfig != null ? cacheTypeConfig.type() : cacheBuildConfig.type();\n        return REDIS_CACHE_TYPE.equals(cacheType);\n    }\n\n    private static Map<String, Type> valueTypesFromCacheResultAnnotation(CombinedIndexBuildItem combinedIndex) {\n        Map<String, Set<Type>> valueTypesFromAnnotations = new HashMap<>();\n\n        // first go through @CacheResult instances and simply record the return types\n        for (AnnotationInstance instance : combinedIndex.getIndex().getAnnotations(CacheDeploymentConstants.CACHE_RESULT)) {","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/redis-cache/deployment/src/main/java/io/quarkus/cache/redis/deployment/RedisCacheProcessor.java#L107-L143","documentation":"During deployment, the Redis cache extension must know the Java value type of each Redis cache so it can configure the marshaller; unlike keys, values cannot always be inferred. If neither the cached method return types (via @CacheResult annotations) nor the quarkus.cache.redis.<cache>.value-type configuration determine the type, the build fails with a DeploymentException.","triggerScenarios":"Building (deployment phase) an application that declares a Redis cache whose value type cannot be resolved from annotated cache methods and for which quarkus.cache.redis.<cacheName>.value-type is not set.","commonSituations":"Programmatically obtained caches (CogrCache.getOrCreate without typed method annotations); caches only used with type-parameterized get(key, type, loader) calls at runtime; refactoring that removed @CacheResult annotations while keeping the cache configured.","solutions":["Set the value type explicitly in application.properties: quarkus.cache.redis.<cacheName>.value-type=com.example.MyType","Annotate the caching method with @CacheResult(cacheName=...) so the processor can infer the value type from the method return type","Remove the unused Redis cache configuration entry if the cache is not actually used","Check for typos in the cache name between config and @CacheResult annotations"],"exampleFix":"// before\nquarkus.cache.redis.my-cache.enabled=true\n// after\nquarkus.cache.redis.my-cache.enabled=true\nquarkus.cache.redis.my-cache.value-type=org.acme.Customer","handlingStrategy":"validation","validationCode":"// check before build/deploy\nString t = System.getProperty(\"quarkus.cache.redis.my-cache.value-type\");\nif (t == null) throw new IllegalStateException(\"Set quarkus.cache.redis.my-cache.value-type\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set value-type for every configured Redis cache without an @CacheResult method","Name caches consistently between config and annotations","Run a compile/deploy step in CI to surface DeploymentException early"],"tags":["quarkus","redis-cache","deployment","configuration","value-type"],"backgroundTag":"missing-config-property","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"}