go-redis/redis · error
both LibName and LibVer cannot be set at the same time
Error message
both LibName and LibVer cannot be set at the same time
What it means
Error "both LibName and LibVer cannot be set at the same time" thrown in go-redis/redis.
Source
Thrown at commands.go:351
panic(err.Error())
}
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)View on GitHub (pinned to 36d97525cd)
Solutions
- Set either LibName or LibVer on the library config, not both
- Split into two calls if you need to send both name and version information
When it happens
Trigger: Thrown at commands.go:351 when the library encounters an invalid state.
Common situations: Validate the options struct at construction time so mutually exclusive fields cannot both be populated.
AI-assisted analysis of go-redis/redis@36d97525cd (2026-08-06).
Data as JSON: /data/errors/4f8bc7f0b2ad11eb.json.
Report an issue: GitHub.