go-redis/redis · error
redis: ScanSlice(nil)
Error message
redis: ScanSlice(nil)
What it means
Error "redis: ScanSlice(nil)" thrown in go-redis/redis.
Source
Thrown at internal/proto/scan.go:132
return err
}
*v = time.Duration(n)
return nil
case encoding.BinaryUnmarshaler:
return v.UnmarshalBinary(b)
case *net.IP:
*v = b
return nil
default:
return fmt.Errorf(
"redis: can't unmarshal %T (consider implementing BinaryUnmarshaler)", v)
}
}
func ScanSlice(data []string, slice interface{}) error {
v := reflect.ValueOf(slice)
if !v.IsValid() {
return fmt.Errorf("redis: ScanSlice(nil)")
}
if v.Kind() != reflect.Ptr {
return fmt.Errorf("redis: ScanSlice(non-pointer %T)", slice)
}
v = v.Elem()
if v.Kind() != reflect.Slice {
return fmt.Errorf("redis: ScanSlice(non-slice %T)", slice)
}
next := makeSliceNextElemFunc(v)
for i, s := range data {
elem := next()
if err := Scan([]byte(s), elem.Addr().Interface()); err != nil {
err = fmt.Errorf("redis: ScanSlice index=%d value=%q failed: %w", i, s, err)
return err
}
}
View on GitHub (pinned to 36d97525cd)
Solutions
- Pass a non-nil slice pointer to ScanSlice
- Allocate the destination slice variable before the call
When it happens
Trigger: Thrown at internal/proto/scan.go:132 when the library encounters an invalid state.
Common situations: Guard ScanSlice destinations against nil at the call site.
AI-assisted analysis of go-redis/redis@36d97525cd (2026-08-06).
Data as JSON: /data/errors/91cc64cc57a4d863.json.
Report an issue: GitHub.