{"id":"e0b83a62980286bf","repo":"redis/node-redis","slug":"client-side-caching-is-only-supported-with-resp3-e0b83a","errorCode":null,"errorMessage":"Client Side Caching is only supported with RESP3","messagePattern":"Client Side Caching is only supported with RESP3","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/client/lib/sentinel/index.ts","lineNumber":837,"sourceCode":"\n  #connectPromise?: Promise<void>;\n  #maxCommandRediscovers: number;\n  readonly #pubSubProxy: PubSubProxy;\n\n  #scanTimer?: NodeJS.Timeout\n\n  #destroy = false;\n\n  #trace: (msg: string) => unknown = () => { };\n\n  #clientSideCache?: PooledClientSideCacheProvider;\n  get clientSideCache() {\n    return this.#clientSideCache;\n  }\n\n  #validateOptions(options?: RedisSentinelOptions<M, F, S, RESP, TYPE_MAPPING>) {\n    if (options?.clientSideCache && (options?.RESP ?? DEFAULT_RESP) !== 3) {\n      throw new Error('Client Side Caching is only supported with RESP3');\n    }\n  }\n\n  constructor(options: RedisSentinelOptions<M, F, S, RESP, TYPE_MAPPING>, sentinelClientId: string) {\n    super();\n\n    this.#validateOptions(options);\n\n    this.#name = options.name;\n    this.#sentinelClientId = sentinelClientId;\n\n    this.#RESP = options.RESP;\n    this.#keyPrefix = options.keyPrefix;\n    this.#sentinelSeedNodes = Array.from(options.sentinelRootNodes);\n    // Initial root nodes start as a copy of the seed nodes; transform() later\n    // merges discovered nodes on top while preserving these seeds.\n    this.#sentinelRootNodes = Array.from(this.#sentinelSeedNodes);\n    this.#maxCommandRediscovers = options.maxCommandRediscovers ?? 16;","sourceCodeStart":819,"sourceCodeEnd":855,"githubUrl":"https://github.com/redis/node-redis/blob/bb5beb56578573910e2ee8f39681edc214c41398/packages/client/lib/sentinel/index.ts#L819-L855","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Use RESP3 (the default) — remove the RESP:2 override, or set RESP:3 explicitly.","Ensure the Redis server version supports RESP3 (Redis >= 6 with RESP3, typically 7+).","If you must stay on RESP2, do not enable clientSideCache.","Pass a PooledClientSideCacheProvider instance or a BasicPooledClientSideCache config only with RESP3."],"exampleFix":"// before\ncreateSentinel({ clientSideCache: { evictionPolicy: ... }, RESP: 2 });\n\n// after\ncreateSentinel({ clientSideCache: { evictionPolicy: ... }, RESP: 3 });","handlingStrategy":"validation","validationCode":"function validateCsc(opts) { if (opts.clientSideCache && (opts.RESP ?? 3) !== 3) throw new Error('clientSideCache requires RESP3'); }","typeGuard":"function cscCompatible(opts) { return !opts.clientSideCache || (opts.RESP ?? 3) === 3; }","tryCatchPattern":"// Construction-time error: fix config before constructing, no runtime catch needed.","preventionTips":["Do not set RESP:2 when enabling clientSideCache.","Ensure Redis server supports RESP3.","Reuse CSC config objects only with RESP3 sentinel clients."],"tags":["sentinel","client-side-caching","resp3","configuration","validation"],"analyzedSha":"bb5beb56578573910e2ee8f39681edc214c41398","analyzedAt":"2026-08-03T19:09:15.686Z","schemaVersion":2}