go-redis/redis · error

redis: Scan(nil)

Error message

redis: Scan(nil)

What it means

Error "redis: Scan(nil)" thrown in go-redis/redis.

Source

Thrown at internal/proto/scan.go:19

package proto

import (
	"encoding"
	"fmt"
	"net"
	"reflect"
	"time"

	"github.com/redis/go-redis/v9/internal/util"
)

// Scan parses bytes `b` to `v` with appropriate type.
//
//nolint:gocyclo
func Scan(b []byte, v interface{}) error {
	switch v := v.(type) {
	case nil:
		return fmt.Errorf("redis: Scan(nil)")
	case *string:
		*v = util.BytesToString(b)
		return nil
	case *[]byte:
		*v = b
		return nil
	case *int:
		var err error
		*v, err = util.Atoi(b)
		return err
	case *int8:
		n, err := util.ParseInt(b, 10, 8)
		if err != nil {
			return err
		}
		*v = int8(n)
		return nil
	case *int16:

View on GitHub (pinned to 36d97525cd)

Solutions

  1. Pass a non-nil destination to Scan
  2. Initialize the destination before calling

When it happens

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

Common situations: Nil-check scan destinations in shared helpers.


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