{"record":{"id":"711913e447524585","repo":"redis/jedis","slug":"client-side-caching-is-only-supported-with-redis","errorCode":null,"errorMessage":"Client side caching is only supported with 'Redis 7.4' or later.","messagePattern":"Client side caching is only supported with 'Redis 7\\.4' or later\\.","errorType":"exception","errorClass":"JedisException","httpStatus":null,"severity":"error","filePath":"src/main/java/redis/clients/jedis/csc/CacheConnection.java","lineNumber":156,"sourceCode":"    // this line actually provides a deep copy of cached object instance\n    value = cacheEntry.getValue();\n    return value;\n  }\n\n  public Cache getCache() {\n    return cache;\n  }\n\n  private void initializeClientSideCache() {\n    if (getRedisProtocol() != RedisProtocol.RESP3) {\n      throw new JedisException(\"Client side caching is only supported with RESP3.\");\n    }\n    Objects.requireNonNull(cache);\n    if (!cache.compatibilityMode()) {\n      RedisVersion current = new RedisVersion(version);\n      RedisVersion required = new RedisVersion(MIN_REDIS_VERSION);\n      if (!REDIS.equals(server) || current.compareTo(required) < 0) {\n        throw new JedisException(\n          String.format(\"Client side caching is only supported with 'Redis %s' or later.\", MIN_REDIS_VERSION));\n      }\n    }\n    addPushConsumer(new PushInvalidateConsumer(cache));\n    sendCommand(Protocol.Command.CLIENT, \"TRACKING\", \"ON\");\n    String reply = getStatusCodeReply();\n    if (!\"OK\".equals(reply)) {\n      throw new JedisException(\"Could not enable client tracking. Reply: \" + reply);\n    }\n  }\n\n  @SuppressWarnings(\"rawtypes\")\n  private CacheEntry validateEntry(CacheEntry cacheEntry) {\n    CacheConnection cacheOwner = cacheEntry.getConnection();\n    if (cacheOwner == null || cacheOwner.isBroken() || !cacheOwner.isConnected()) {\n      cache.delete(cacheEntry.getCacheKey());\n      return null;\n    } else {","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/redis/jedis/blob/6dac31d4c224fb3257c216f3985340c6f500cdcb/src/main/java/redis/clients/jedis/csc/CacheConnection.java#L138-L174","documentation":"Unless the Cache was explicitly put in compatibility mode, initializeClientSideCache verifies the server advertises itself as 'redis' with version >= 7.4 (MIN_REDIS_VERSION) before issuing CLIENT TRACKING ON. Older servers or non-Redis endpoints fail this check and a JedisException is thrown. Newer tracking semantics (e.g. broadcast/format behavior) rely on 7.4+ features.","triggerScenarios":"Connecting a CacheConnection (directly or via initializeFromClientConfig) to a Redis server reporting INFO server version < 7.4, or to a server whose 'server' field is not 'redis' (e.g. keydb, dragonfly, memtier proxies) while cache.compatibilityMode() is false.","commonSituations":"Running against an older Redis fleet after adding client-side caching; using Redis-compatible servers/proxies that report a different 'server' name or downlevel version; version drift between environments (dev on 7.4, prod on 6.x).","solutions":["Upgrade the Redis server to 7.4 or later.","If you accept degraded semantics, enable compatibility mode on your cache (cache.setCacheable/CacheConfig with compatibilityMode true, e.g. DefaultCache.setCompatibilityMode(true)) so this check is skipped.","Pin environment versions so dev/prod both run >= 7.4; check INFO server during rollout.","For non-'redis' server forks/proxies, either use compatibility mode or switch to genuine Redis for csc workloads."],"exampleFix":"// before\nCache cache = CacheFactory.getCache(config); // compatibilityMode = false, server = Redis 6.2\n// after\ncache.setCompatibilityMode(true); // or upgrade Redis to >= 7.4","handlingStrategy":"validation","validationCode":"// check server before enabling csc\nMap<String, String> info = jedis.info(\"server\");\nString version = info.get(\"redis_version\");\nif (compareVersion(version, \"7.4\") < 0 && !cache.compatibilityMode()) {\n  cache.setCompatibilityMode(true); // or upgrade the server\n}","typeGuard":null,"tryCatchPattern":"try {\n  CacheConnection conn = CacheConnection.builder(cache).clientConfig(cfg).build();\n} catch (JedisException e) {\n  if (e.getMessage().contains(\"or later\")) {\n    cache.setCompatibilityMode(true); // retry in compatibility mode\n  } else throw e;\n}","preventionTips":["Pin Redis >= 7.4 in all environments used with client-side caching","Enable compatibility mode when running against Redis-compatible forks/proxies","Add an INFO-server version gate to deployment health checks before opening caching connections"],"tags":["client-side-caching","version-check","redis-7-4"],"backgroundTag":"invalid-config-value","analyzedSha":"6dac31d4c224fb3257c216f3985340c6f500cdcb","analyzedAt":"2026-09-08T04:55:01.204Z","contentChangedAt":"2026-09-08T04:55:01.204Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}