{"record":{"id":"f3265bc2ea319a55","repo":"redis/go-redis","slug":"redis-newring-nil-options","errorCode":null,"errorMessage":"redis: NewRing nil options","messagePattern":"redis: NewRing nil options","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"ring.go","lineNumber":629,"sourceCode":"//\n// Ring should be used when you need multiple Redis servers for caching\n// and can tolerate losing data when one of the servers dies.\n// Otherwise you should use Redis Cluster.\ntype Ring struct {\n\tcmdable\n\thooksMixin\n\n\topt               *RingOptions\n\tsharding          *ringSharding\n\tcmdsInfoCache     *cmdsInfoCache\n\theartbeatCancelFn context.CancelFunc\n}\n\n// NewRing returns a Redis Ring client to the Redis Server specified by RingOptions.\n// Passing nil RingOptions will cause a panic.\nfunc NewRing(opt *RingOptions) *Ring {\n\tif opt == nil {\n\t\tpanic(\"redis: NewRing nil options\")\n\t}\n\t// Shallow-copy the options: the ring-wide HIMPORT registry is carried\n\t// through them to shard construction, and reusing one caller-owned\n\t// RingOptions across several rings must not make the rings share (or\n\t// clobber each other's) registry.\n\toptCopy := *opt\n\topt = &optCopy\n\topt.init()\n\t// The registry must exist before the first shard is created; shards\n\t// adopt it in newRingShard.\n\topt.himport = newHImportRegistry()\n\n\thbCtx, hbCancel := context.WithCancel(context.Background())\n\n\tring := Ring{\n\t\topt:               opt,\n\t\tsharding:          newRingSharding(opt),\n\t\theartbeatCancelFn: hbCancel,","sourceCodeStart":611,"sourceCodeEnd":647,"githubUrl":"https://github.com/redis/go-redis/blob/c5cad058c72f58370553b48566302303cf8a2e89/ring.go#L611-L647","documentation":"Error \"redis: NewRing nil options\" thrown in redis/go-redis.","triggerScenarios":"Thrown at ring.go:629 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"c5cad058c72f58370553b48566302303cf8a2e89","analyzedAt":"2026-09-01T06:50:53.388Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}