{"record":{"id":"1984a4acd230adc8","repo":"redis/jedis","slug":"could-not-enable-client-tracking-reply-reply","errorCode":null,"errorMessage":"Could not enable client tracking. Reply: ${reply}","messagePattern":"Could not enable client tracking\\. Reply: (.+?)","errorType":"exception","errorClass":"JedisException","httpStatus":null,"severity":"error","filePath":"src/main/java/redis/clients/jedis/csc/CacheConnection.java","lineNumber":164,"sourceCode":"\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 {\n      try {\n        cacheOwner.readPushesWithCheckingBroken();\n      } catch (JedisException e) {\n        cache.delete(cacheEntry.getCacheKey());\n        return null;\n      }\n\n      return cache.get(cacheEntry.getCacheKey());","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/redis/jedis/blob/6dac31d4c224fb3257c216f3985340c6f500cdcb/src/main/java/redis/clients/jedis/csc/CacheConnection.java#L146-L182","documentation":"After registering the invalidation push consumer, initializeClientSideCache sends CLIENT TRACKING ON and expects a simple status reply of OK. Any other reply (e.g. ERR from a server that rejects or does not support tracking, or a proxy swallowing it) raises this JedisException containing the raw reply. This catches servers that passed the version check but still refused the command.","triggerScenarios":"CLIENT TRACKING ON returns a non-OK status reply — e.g. server rejects tracking due to maxmemory-policy/proxy interference, command renamed or disabled via rename-command, a proxy in front of Redis not forwarding CLIENT subcommands, or RESP3 push negotiation failing.","commonSituations":"Deployments behind HAProxy/Twemproxy that filter CLIENT commands; secured clusters where CLIENT is renamed; Redis Enterprise or managed services restricting CLIENT TRACKING; race conditions where the connection is switched to another server mid-init.","solutions":["Read the reply text in the exception message and fix the server-side cause (e.g. un-rename/enable the CLIENT command).","Ensure the client connects directly to a Redis 7.4+ node, not through a proxy that strips CLIENT subcommands.","Check server logs for why CLIENT TRACKING was rejected (maxclients, unsupported mode, wrong protocol).","Retry connection establishment if the failure was transient (e.g. failover raced during init)."],"exampleFix":"// server side (redis.conf)\n// before: rename-command CLIENT \"\"\n// after: remove the rename so CLIENT TRACKING works\n# rename-command CLIENT \"\"   <-- delete this line","handlingStrategy":"try-catch","validationCode":"// verify CLIENT TRACKING manually before enabling csc\nString reply = jedis.sendCommand(Protocol.Command.CLIENT, \"TRACKING\", \"OFF\").getStatusCodeReply();\n// ensure reply == OK; ERR indicates tracking is blocked on this server/proxy","typeGuard":null,"tryCatchPattern":"try {\n  CacheConnection conn = CacheConnection.builder(cache).clientConfig(cfg).build();\n} catch (JedisException e) {\n  if (e.getMessage().startsWith(\"Could not enable client tracking\")) {\n    // fall back to a non-caching connection or alert ops (proxy/renamed CLIENT command)\n  } else throw e;\n}","preventionTips":["Do not rename or disable the CLIENT command on servers used for client-side caching","Avoid proxies (Twemproxy/Codis) that strip CLIENT subcommands in front of caching connections","Verify tracking support with CLIENT TRACKING OFF / INFO during infrastructure smoke tests"],"tags":["client-side-caching","client-tracking","command-failed"],"backgroundTag":"api-error-response","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"}