{"record":{"id":"ce80bd86a93d1672","repo":"redis/node-redis","slug":"client-side-caching-is-only-supported-with-resp3","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/client/index.ts","lineNumber":794,"sourceCode":"      this.#queue.addPushHandler((push: Array<any>): boolean => {\n        if (push[0].toString() !== 'invalidate') return false;\n\n        if (push[1] !== null) {\n          for (const key of push[1]) {\n            this.emit('invalidate', key);\n          }\n        } else {\n          this.emit('invalidate', null);\n        }\n        return true\n      });\n    }\n  }\n\n  #validateOptions(options?: RedisClientOptions<M, F, S, RESP, TYPE_MAPPING>) {\n    const resp = options?.RESP ?? DEFAULT_RESP;\n    if (options?.clientSideCache && resp !== 3) {\n      throw new Error('Client Side Caching is only supported with RESP3');\n    }\n    if (options?.emitInvalidate && resp !== 3) {\n      throw new Error('emitInvalidate is only supported with RESP3');\n    }\n    if (options?.clientSideCache && options?.emitInvalidate) {\n      throw new Error('emitInvalidate is not supported (or necessary) when clientSideCache is enabled');\n    }\n    if (options?.maintNotifications && options?.maintNotifications !== 'disabled' && resp !== 3) {\n      throw new Error('Graceful Maintenance is only supported with RESP3');\n    }\n  }\n\n  #initiateOptions(options: RedisClientOptions<M, F, S, RESP, TYPE_MAPPING> = {}): RedisClientOptions<M, F, S, RESP, TYPE_MAPPING> {\n\n    // Convert username/password to credentialsProvider if no credentialsProvider is already in place\n    if (!options.credentialsProvider && (options.username || options.password)) {\n\n      options.credentialsProvider = {","sourceCodeStart":776,"sourceCodeEnd":812,"githubUrl":"https://github.com/redis/node-redis/blob/90fd0652bc3f2a0a1b2f79fa9096b02a86b0ac58/packages/client/lib/client/index.ts#L776-L812","documentation":"Client Side Caching (clientSideCache) relies on RESP3 server push messages (invalidate notifications). With RESP !== 3 the option is rejected in #validateOptions at client construction. RESP3 is negotiated when options.RESP is 3 or unset-and-negotiated-up.","triggerScenarios":"createClient({ clientSideCache: cacheInstance, RESP: 2 }) or any combination where the resolved RESP version is not 3.","commonSituations":"Forcing RESP: 2 for compatibility with an older server while enabling client-side caching; redis server older than 6.0 that does not support RESP3; legacy config copied into a new app.","solutions":["Set RESP: 3 (and ensure the server is redis >= 6 with RESP3 enabled).","Or drop clientSideCache if you must stay on RESP2."],"exampleFix":"// before\ncreateClient({ clientSideCache: myCache });\n\n// after\ncreateClient({ clientSideCache: myCache, RESP: 3 });","handlingStrategy":"validation","validationCode":"function validateCscOptions(options) {\n  const resp = options?.RESP ?? 3;\n  if (options?.clientSideCache && resp !== 3) {\n    throw new Error('clientSideCache requires RESP: 3 (redis >= 6)');\n  }\n  return options;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pair clientSideCache with RESP: 3 explicitly.","Verify the server is redis >= 6 and supports RESP3 before enabling CSC.","Do not force RESP: 2 when you need CSC."],"tags":["config","resp3","client-side-caching","validation"],"backgroundTag":null,"analyzedSha":"90fd0652bc3f2a0a1b2f79fa9096b02a86b0ac58","analyzedAt":"2026-08-11T15:37:21.243Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}