quarkusio/quarkus · error · DeploymentException
Unable to determine the value type for '" + cacheName + "' R
Error message
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
What it means
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.
Source
Thrown at extensions/redis-cache/deployment/src/main/java/io/quarkus/cache/redis/deployment/RedisCacheProcessor.java:125
if (cacheSpecificGroup == null) {
if (defaultValueType.isPresent()) {
valueType = defaultValueType.get();
}
} else {
if (cacheSpecificGroup.valueType().isPresent()) {
valueType = cacheSpecificGroup.valueType().get();
}
}
if (valueType == null && resolvedValuesTypesFromAnnotations.containsKey(cacheName)) {
// 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?
valueType = typeToString(resolvedValuesTypesFromAnnotations.get(cacheName));
}
if (valueType != null) {
valueTypes.put(cacheName, TypeParser.parse(valueType));
} else {
throw new DeploymentException("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");
}
}
recorder.setCacheValueTypes(valueTypes);
}
private static boolean isRedisCache(String cacheName, CacheBuildConfig cacheBuildConfig) {
CacheBuildConfig.CacheTypeBuildConfig cacheTypeConfig = cacheBuildConfig.cacheTypeByName().get(cacheName);
String cacheType = cacheTypeConfig != null ? cacheTypeConfig.type() : cacheBuildConfig.type();
return REDIS_CACHE_TYPE.equals(cacheType);
}
private static Map<String, Type> valueTypesFromCacheResultAnnotation(CombinedIndexBuildItem combinedIndex) {
Map<String, Set<Type>> valueTypesFromAnnotations = new HashMap<>();
// first go through @CacheResult instances and simply record the return types
for (AnnotationInstance instance : combinedIndex.getIndex().getAnnotations(CacheDeploymentConstants.CACHE_RESULT)) {View on GitHub (pinned to e1c734241f)
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
Example fix
// before quarkus.cache.redis.my-cache.enabled=true // after quarkus.cache.redis.my-cache.enabled=true quarkus.cache.redis.my-cache.value-type=org.acme.Customer
Defensive patterns
Strategy: validation
Validate before calling
// check before build/deploy
String t = System.getProperty("quarkus.cache.redis.my-cache.value-type");
if (t == null) throw new IllegalStateException("Set quarkus.cache.redis.my-cache.value-type"); Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Unknown cache type:
- Unsupported type: " + type
- Cannot use `" + methodName + "` method without a default typ
- Failed to load application configuration
- Failed to initialize application configuration
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/3731d630599ff0e1.
Report an issue: GitHub.