go-redis/redis · error

redis: ScanSlice(non-slice %T)

Error message

redis: ScanSlice(non-slice %T)

What it means

Error "redis: ScanSlice(non-slice %T)" thrown in go-redis/redis.

Source

Thrown at internal/proto/scan.go:139

		*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
		}
	}

	return nil
}

func makeSliceNextElemFunc(v reflect.Value) func() reflect.Value {
	elemType := v.Type().Elem()

	if elemType.Kind() == reflect.Ptr {

View on GitHub (pinned to 36d97525cd)

Solutions

  1. Pass a slice type (not a struct/map/scalar) to ScanSlice
  2. Convert the destination to a slice before scanning

When it happens

Trigger: Thrown at internal/proto/scan.go:139 when the library encounters an invalid state.

Common situations: Keep ScanSlice usage to slice destinations; parse other shapes manually.


AI-assisted analysis of go-redis/redis@36d97525cd (2026-08-06). Data as JSON: /data/errors/fcd462e1af342c39.json. Report an issue: GitHub.