go-redis/redis · error
redis: invalid StickyConnPool state: %d
Error message
redis: invalid StickyConnPool state: %d
What it means
Error "redis: invalid StickyConnPool state: %d" thrown in go-redis/redis.
Source
Thrown at internal/pool/pool_sticky.go:195
func (p *StickyConnPool) Reset(ctx context.Context) error {
if p.badConnError() == nil {
return nil
}
select {
case cn, ok := <-p.ch:
if !ok {
return ErrClosed
}
p.pool.Remove(ctx, cn, ErrClosed)
p._badConnError.Store(BadConnError{wrapped: nil})
default:
return errors.New("redis: StickyConnPool does not have a Conn")
}
if !p.state.CompareAndSwap(stateInited, stateDefault) {
state := p.state.Load()
return fmt.Errorf("redis: invalid StickyConnPool state: %d", state)
}
return nil
}
func (p *StickyConnPool) badConnError() error {
if v := p._badConnError.Load(); v != nil {
if err := v.(BadConnError); err.wrapped != nil {
return err
}
}
return nil
}
func (p *StickyConnPool) Len() int {
switch p.state.Load() {
case stateDefault:
return 0View on GitHub (pinned to 36d97525cd)
Solutions
- Recreate the StickyConnPool; its internal state is corrupted by misuse
- Do not call pool methods after Close
When it happens
Trigger: Thrown at internal/pool/pool_sticky.go:195 when the library encounters an invalid state.
Common situations: Track closed state externally and stop using the pool once closed.
AI-assisted analysis of go-redis/redis@36d97525cd (2026-08-06).
Data as JSON: /data/errors/eb1d06c7aeb1d25e.json.
Report an issue: GitHub.