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

Thrown from RedisClusterSlots.#validateOptions (cluster-slots.ts:203) at cluster construction. Client Side Caching (the clientSideCache option) requires RESP3 because server-to-client invalidation push messages are a RESP3 feature; enabling it while explicitly setting RESP: 2 is rejected. Omitting RESP defaults to 3 and is allowed.

Source

Thrown at packages/client/lib/cluster/cluster-slots.ts:203

  readonly scanCursors = new Map<string, ScanCursorEntry>();
  #cursorTokenSeq = 0;
  #topologyRefreshPromise?: Promise<boolean | void>;

  #isOpen = false;

  get isOpen() {
    return this.#isOpen;
  }

  #isReady = false;

  get isReady() {
    return this.#isReady;
  }

  #validateOptions(options?: RedisClusterOptions<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: RedisClusterOptions<M, F, S, RESP, TYPE_MAPPING>,
    emit: EventEmitter['emit'],
    clusterClientId: string
  ) {
    this.#validateOptions(options);
    this.#options = options;
    this.#himportRegistry = options.himportRegistry ?? new FieldsetRegistry();
    this.#clusterClientId = clusterClientId;
    this.#reconnectionTracker = new ClusterReconnectionTracker(options.topologyRefreshOnReconnectionAttemptStrategy);

    if (options?.clientSideCache) {
      if (options.clientSideCache instanceof PooledClientSideCacheProvider) {
        this.clientSideCache = options.clientSideCache;
      } else {

View on GitHub (pinned to bb5beb5657)

Solutions

  1. Remove the explicit RESP: 2 so the cluster defaults to RESP3.
  2. Or explicitly set RESP: 3 when enabling clientSideCache.
  3. Upgrade Redis to >= 6.0 with RESP3 support (>= 7.0 recommended) before using client-side caching.

Example fix

// before
const cluster = createCluster({
  rootNodes,
  RESP: 2 as const,
  clientSideCache: { ttl: 0, maxEntries: 100 }
}); // throws

// after
const cluster = createCluster({
  rootNodes,
  RESP: 3 as const,
  clientSideCache: { ttl: 0, maxEntries: 100 }
});
Defensive patterns

Strategy: validation

Validate before calling

const opts = { clientSideCache: { ttl: 0, maxEntries: 100 } };
if (opts.clientSideCache && (explicitResp ?? 3) !== 3) {
  throw new Error('drop RESP:2 or clientSideCache');
}

Prevention

When it happens

Trigger: createCluster({ clientSideCache: {...}, RESP: 2 }) — explicitly opting into RESP2 together with client-side caching.

Common situations: Copying a RESP2 standalone-client config into a cluster; mixing legacy RESP2 settings with the newer CSC option; explicit RESP:2 for compatibility with an older Redis.

Related errors


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