redis/node-redis · error · Error

Client Side Caching is only supported with RESP3

Error message

Client Side Caching is only supported with RESP3

What it means

RedisSentinelInternal.#validateOptions rejects enabling clientSideCache unless the negotiated RESP version is 3. Client-side caching (server-assisted, push-based invalidation) requires RESP3 protocol features; RESP2 has no native CSC support in this client, so the combination is refused at construction time.

Source

Thrown at packages/client/lib/sentinel/index.ts:837

  #connectPromise?: Promise<void>;
  #maxCommandRediscovers: number;
  readonly #pubSubProxy: PubSubProxy;

  #scanTimer?: NodeJS.Timeout

  #destroy = false;

  #trace: (msg: string) => unknown = () => { };

  #clientSideCache?: PooledClientSideCacheProvider;
  get clientSideCache() {
    return this.#clientSideCache;
  }

  #validateOptions(options?: RedisSentinelOptions<M, F, S, RESP, TYPE_MAPPING>) {
    if (options?.clientSideCache && (options?.RESP ?? DEFAULT_RESP) !== 3) {
      throw new Error('Client Side Caching is only supported with RESP3');
    }
  }

  constructor(options: RedisSentinelOptions<M, F, S, RESP, TYPE_MAPPING>, sentinelClientId: string) {
    super();

    this.#validateOptions(options);

    this.#name = options.name;
    this.#sentinelClientId = sentinelClientId;

    this.#RESP = options.RESP;
    this.#keyPrefix = options.keyPrefix;
    this.#sentinelSeedNodes = Array.from(options.sentinelRootNodes);
    // Initial root nodes start as a copy of the seed nodes; transform() later
    // merges discovered nodes on top while preserving these seeds.
    this.#sentinelRootNodes = Array.from(this.#sentinelSeedNodes);
    this.#maxCommandRediscovers = options.maxCommandRediscovers ?? 16;

View on GitHub (pinned to bb5beb5657)

Solutions

  1. Use RESP3 (the default) — remove the RESP:2 override, or set RESP:3 explicitly.
  2. Ensure the Redis server version supports RESP3 (Redis >= 6 with RESP3, typically 7+).
  3. If you must stay on RESP2, do not enable clientSideCache.
  4. Pass a PooledClientSideCacheProvider instance or a BasicPooledClientSideCache config only with RESP3.

Example fix

// before
createSentinel({ clientSideCache: { evictionPolicy: ... }, RESP: 2 });

// after
createSentinel({ clientSideCache: { evictionPolicy: ... }, RESP: 3 });
Defensive patterns

Strategy: validation

Validate before calling

function validateCsc(opts) { if (opts.clientSideCache && (opts.RESP ?? 3) !== 3) throw new Error('clientSideCache requires RESP3'); }

Type guard

function cscCompatible(opts) { return !opts.clientSideCache || (opts.RESP ?? 3) === 3; }

Try / catch

// Construction-time error: fix config before constructing, no runtime catch needed.

Prevention

When it happens

Trigger: Constructing createSentinel({ clientSideCache: {...}, RESP: 2 }) (or omitting RESP, but it defaults to 3, so this requires explicitly setting RESP:2). Also when a shared options object forces RESP:2 while CSC is enabled.

Common situations: Migrating from an older RESP2 sentinel config while enabling CSC; forcing RESP:2 for compatibility with an older Redis and forgetting CSC needs RESP3; copying options from a non-CSC RESP2 client.

Related errors


AI-assisted analysis of redis/node-redis@bb5beb5657 (2026-08-03). Data as JSON: /data/errors/e0b83a62980286bf.json. Report an issue: GitHub.