{"id":"7cde5cc1771b29e0","repo":"go-redis/redis","slug":"redis-select-is-not-allowed-when-client-side-cach","errorCode":null,"errorMessage":"redis: SELECT is not allowed when client-side caching is enabled","messagePattern":"redis: SELECT is not allowed when client-side caching is enabled","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"csc_integration.go","lineNumber":523,"sourceCode":"// not establish tracked coverage, either because init failed or tracking was\n// rejected and CSC was disabled.\nfunc (c *baseClient) cscForgetConn(connID uint64) {\n\tif h := c.cscHook(); h != nil {\n\t\th.forgetConn(connID)\n\t}\n}\n\n// errClientTrackingWithCSC rejects CLIENT TRACKING on clients with built-in CSC\n// (see the guards in baseClient.process and generalProcessPipeline). The raw\n// escape hatches — Do(ctx, \"client\", \"tracking\", ...) with string or []byte\n// args, and pipelines — are also caught: the guard matches on the command's\n// leading args, not the typed method.\nvar errClientTrackingWithCSC = errors.New(\n\t\"redis: CLIENT TRACKING is not allowed when client-side caching is enabled\")\n\n// errSelectWithCSC rejects runtime SELECT on clients with built-in CSC. Cache\n// keys use Options.DB, while SELECT mutates only the chosen pool connection.\nvar errSelectWithCSC = errors.New(\n\t\"redis: SELECT is not allowed when client-side caching is enabled\")\n\n// errAuthWithCSC rejects runtime authentication because it can change one\n// connection's ACL identity without changing the client's fixed cache namespace.\nvar errAuthWithCSC = errors.New(\n\t\"redis: AUTH is not allowed when client-side caching is enabled\")\n\n// errHelloWithCSC rejects HELLO with arguments because it can switch a tracked\n// connection out of RESP3 (and can also change authentication).\nvar errHelloWithCSC = errors.New(\n\t\"redis: HELLO with arguments is not allowed when client-side caching is enabled\")\n\n// errResetWithCSC rejects RESET because it disables tracking and switches the\n// connection to RESP2.\nvar errResetWithCSC = errors.New(\n\t\"redis: RESET is not allowed when client-side caching is enabled\")\n\n// errSubscribeWithCSC rejects raw subscriptions on the ordinary pool. The","sourceCodeStart":505,"sourceCodeEnd":541,"githubUrl":"https://github.com/go-redis/redis/blob/36d97525cd8076aed67cddf54778e9ea84550929/csc_integration.go#L505-L541","documentation":"Error \"redis: SELECT is not allowed when client-side caching is enabled\" thrown in go-redis/redis.","triggerScenarios":"Thrown at csc_integration.go:523 when the library encounters an invalid state.","commonSituations":"Avoid mid-session SELECT by fixing the database at client construction.","solutions":["Create a separate client (without client-side caching) per logical database instead of calling SELECT","Configure the DB number in redis.Options when CSC is enabled"],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"36d97525cd8076aed67cddf54778e9ea84550929","analyzedAt":"2026-08-06T01:08:27.376Z","schemaVersion":2}