redis/go-redis · error

redis: NewClient nil options

Error message

redis: NewClient nil options

What it means

Error "redis: NewClient nil options" thrown in redis/go-redis.

Source

Thrown at redis.go:2083

	*baseClient
	cmdable

	// cscLifecycleOwner keeps the canonical Client wrapper (the one whose GC
	// cleanup owns the drainer) reachable while a WithTimeout clone can still
	// serve from its cache. Nil on the canonical wrapper and on non-CSC clones.
	cscLifecycleOwner *Client

	autopipelinerMu     *sync.Mutex    // guards the autopipeliner fields against concurrent first-call creation
	autopipeliner       *AutoPipeliner // blocking face (Client.AutoPipeline)
	asyncAutopipeliner  *AutoPipeliner // deferred face (Client.AsyncAutoPipeline)
	autopipelinerClosed bool           // set by Close: refuse to resurrect a pipeliner on a closed client
}

// NewClient returns a client to the Redis Server specified by Options.
// Passing nil Options will cause a panic.
func NewClient(opt *Options) *Client {
	if opt == nil {
		panic("redis: NewClient nil options")
	}
	// clone to not share options with the caller
	opt = opt.clone()
	opt.init()

	// Push notifications are always enabled for RESP3 (cannot be disabled)

	c := Client{
		baseClient: &baseClient{
			apClosed: &atomic.Bool{},
			opt:      opt,
			onClose:  &onCloseHooks{},
			himport:  newHImportRegistry(),
		},
	}
	c.init()

	// Initialize push notification processor using shared helper

View on GitHub (pinned to c5cad058c7)

When it happens

Trigger: Thrown at redis.go:2083 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of redis/go-redis@c5cad058c7 (2026-09-01). Data as JSON: /api/errors/e2d2d5e5905c5289. Report an issue: GitHub.