{"id":"9c53ac91f1805e2d","repo":"go-redis/redis","slug":"at-least-one-of-libname-and-libver-should-be-set","errorCode":null,"errorMessage":"at least one of LibName and LibVer should be set","messagePattern":"at least one of LibName and LibVer should be set","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"commands.go","lineNumber":354,"sourceCode":"\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\")\n\t}\n\tif info.LibName == nil && info.LibVer == nil {\n\t\treturn errors.New(\"at least one of LibName and LibVer should be set\")\n\t}\n\treturn nil\n}\n\n// Hello sets the resp protocol used.\nfunc (c statefulCmdable) Hello(ctx context.Context,\n\tver int, username, password, clientName string,\n) *MapStringInterfaceCmd {\n\targs := make([]interface{}, 0, 7)\n\targs = append(args, \"hello\", ver)\n\tif password != \"\" {\n\t\tif username != \"\" {\n\t\t\targs = append(args, \"auth\", username, password)\n\t\t} else {\n\t\t\targs = append(args, \"auth\", \"default\", password)\n\t\t}\n\t}\n\tif clientName != \"\" {","sourceCodeStart":336,"sourceCodeEnd":372,"githubUrl":"https://github.com/go-redis/redis/blob/36d97525cd8076aed67cddf54778e9ea84550929/commands.go#L336-L372","documentation":"Error \"at least one of LibName and LibVer should be set\" thrown in go-redis/redis.","triggerScenarios":"Thrown at commands.go:354 when the library encounters an invalid state.","commonSituations":"Fail fast during options construction when both library identity fields are empty.","solutions":["Set at least one of LibName or LibVer before issuing the command","Default LibName to your application name when neither is configured"],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"36d97525cd8076aed67cddf54778e9ea84550929","analyzedAt":"2026-08-06T01:08:27.376Z","schemaVersion":2}