go-redis/redis · error
at least one of LibName and LibVer should be set
Error message
at least one of LibName and LibVer should be set
What it means
Error "at least one of LibName and LibVer should be set" thrown in go-redis/redis.
Source
Thrown at commands.go:354
var cmd *StatusCmd
if info.LibName != nil {
libName := fmt.Sprintf("go-redis(%s,%s)", *info.LibName, internal.ReplaceSpaces(runtime.Version()))
cmd = NewStatusCmd(ctx, "client", "setinfo", "LIB-NAME", libName)
} else {
cmd = NewStatusCmd(ctx, "client", "setinfo", "LIB-VER", *info.LibVer)
}
_ = c(ctx, cmd)
return cmd
}
// Validate checks if only one field in the struct is non-nil.
func (info LibraryInfo) Validate() error {
if info.LibName != nil && info.LibVer != nil {
return errors.New("both LibName and LibVer cannot be set at the same time")
}
if info.LibName == nil && info.LibVer == nil {
return errors.New("at least one of LibName and LibVer should be set")
}
return nil
}
// Hello sets the resp protocol used.
func (c statefulCmdable) Hello(ctx context.Context,
ver int, username, password, clientName string,
) *MapStringInterfaceCmd {
args := make([]interface{}, 0, 7)
args = append(args, "hello", ver)
if password != "" {
if username != "" {
args = append(args, "auth", username, password)
} else {
args = append(args, "auth", "default", password)
}
}
if clientName != "" {View on GitHub (pinned to 36d97525cd)
Solutions
- Set at least one of LibName or LibVer before issuing the command
- Default LibName to your application name when neither is configured
When it happens
Trigger: Thrown at commands.go:354 when the library encounters an invalid state.
Common situations: Fail fast during options construction when both library identity fields are empty.
AI-assisted analysis of go-redis/redis@36d97525cd (2026-08-06).
Data as JSON: /data/errors/9c53ac91f1805e2d.json.
Report an issue: GitHub.