{"record":{"id":"d36ba3287345cf93","repo":"redis/go-redis","slug":"panic-err-error","errorCode":null,"errorMessage":"panic(err.Error())","messagePattern":"panic\\(err\\.Error\\(\\)\\)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"commands.go","lineNumber":333,"sourceCode":"\nfunc (c statefulCmdable) SwapDB(ctx context.Context, index1, index2 int) *StatusCmd {\n\tcmd := NewStatusCmd(ctx, \"swapdb\", index1, index2)\n\t_ = c(ctx, cmd)\n\treturn cmd\n}\n\n// ClientSetName assigns a name to the connection.\nfunc (c statefulCmdable) ClientSetName(ctx context.Context, name string) *BoolCmd {\n\tcmd := NewBoolCmd(ctx, \"client\", \"setname\", name)\n\t_ = c(ctx, cmd)\n\treturn cmd\n}\n\n// ClientSetInfo sends a CLIENT SETINFO command with the provided info.\nfunc (c statefulCmdable) ClientSetInfo(ctx context.Context, info LibraryInfo) *StatusCmd {\n\terr := info.Validate()\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\n\tvar cmd *StatusCmd\n\tif info.LibName != nil {\n\t\tlibName := fmt.Sprintf(\"go-redis(%s,%s)\", *info.LibName, internal.ReplaceSpaces(runtime.Version()))\n\t\tcmd = NewStatusCmd(ctx, \"client\", \"setinfo\", \"LIB-NAME\", libName)\n\t} else {\n\t\tcmd = NewStatusCmd(ctx, \"client\", \"setinfo\", \"LIB-VER\", *info.LibVer)\n\t}\n\n\t_ = c(ctx, cmd)\n\treturn cmd\n}\n\n// Validate checks if only one field in the struct is non-nil.\nfunc (info LibraryInfo) Validate() error {\n\tif info.LibName != nil && info.LibVer != nil {\n\t\treturn errors.New(\"both LibName and LibVer cannot be set at the same time\")","sourceCodeStart":315,"sourceCodeEnd":351,"githubUrl":"https://github.com/redis/go-redis/blob/c5cad058c72f58370553b48566302303cf8a2e89/commands.go#L315-L351","documentation":"Error \"panic(err.Error())\" thrown in redis/go-redis.","triggerScenarios":"Thrown at commands.go:333 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"}