{"id":"eb1d06c7aeb1d25e","repo":"go-redis/redis","slug":"redis-invalid-stickyconnpool-state-d","errorCode":null,"errorMessage":"redis: invalid StickyConnPool state: %d","messagePattern":"redis: invalid StickyConnPool state: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/pool/pool_sticky.go","lineNumber":195,"sourceCode":"func (p *StickyConnPool) Reset(ctx context.Context) error {\n\tif p.badConnError() == nil {\n\t\treturn nil\n\t}\n\n\tselect {\n\tcase cn, ok := <-p.ch:\n\t\tif !ok {\n\t\t\treturn ErrClosed\n\t\t}\n\t\tp.pool.Remove(ctx, cn, ErrClosed)\n\t\tp._badConnError.Store(BadConnError{wrapped: nil})\n\tdefault:\n\t\treturn errors.New(\"redis: StickyConnPool does not have a Conn\")\n\t}\n\n\tif !p.state.CompareAndSwap(stateInited, stateDefault) {\n\t\tstate := p.state.Load()\n\t\treturn fmt.Errorf(\"redis: invalid StickyConnPool state: %d\", state)\n\t}\n\n\treturn nil\n}\n\nfunc (p *StickyConnPool) badConnError() error {\n\tif v := p._badConnError.Load(); v != nil {\n\t\tif err := v.(BadConnError); err.wrapped != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (p *StickyConnPool) Len() int {\n\tswitch p.state.Load() {\n\tcase stateDefault:\n\t\treturn 0","sourceCodeStart":177,"sourceCodeEnd":213,"githubUrl":"https://github.com/go-redis/redis/blob/36d97525cd8076aed67cddf54778e9ea84550929/internal/pool/pool_sticky.go#L177-L213","documentation":"Error \"redis: invalid StickyConnPool state: %d\" thrown in go-redis/redis.","triggerScenarios":"Thrown at internal/pool/pool_sticky.go:195 when the library encounters an invalid state.","commonSituations":"Track closed state externally and stop using the pool once closed.","solutions":["Recreate the StickyConnPool; its internal state is corrupted by misuse","Do not call pool methods after Close"],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"36d97525cd8076aed67cddf54778e9ea84550929","analyzedAt":"2026-08-06T01:08:27.376Z","schemaVersion":2}