Redis: "ERR wrong number of arguments for 'auth' command" after updating to v8

Created on 25 May 2020  ·  6Comments  ·  Source: go-redis/redis

I'm using the the parseURL function and connecting works fine when using a simple localhost connection string, but when using our production string that has username and password I get the err above.

Working fine:

info, err := redis.ParseURL("redis://localhost:6379")
if err != nil {
    return nil, err
}
c, err = redis.NewClient(info), nil
// err == nil

Giving error:

info, err := redis.ParseURL("redis://admin:[email protected]:4325")
if err != nil {
    return nil, err
}
c, err = redis.NewClient(info), nil
// err.Error() == "ERR wrong number of arguments for 'auth' command"

I'm kind of at a loss for how to proceed, so any help is appreciated!

Most helpful comment

i meet the same problem
for redis 6 and greater, nothing changes
for lesser, i fix it by setting username as "" and it works for me.

All 6 comments

what is your redis version? The username is supported after 6.0.

by the way, it's dangerous to display your username and password.

I did some investigating and if I go back to go-redis/redis/[email protected] (which I was using previously) I do not get this error message.

If I up to 7.3.0 however, I do get this error.

Redis version is 4.0.9 on production server and 3.2.0 on development machine.

Thanks, those are just example credentials though, they aren't real :)

i meet the same problem
for redis 6 and greater, nothing changes
for lesser, i fix it by setting username as "" and it works for me.

Having the same error using the latest v8 beta of go-redis and redis v5

From what I've heard the problem is that your connection string contains a fake username redis://admin:[email protected]:4325 - admin in this case. The fix is to remove username before connecting:

info, err := redis.ParseURL("redis://admin:[email protected]:4325")
if err != nil {
    return nil, err
}
info.Username = ""
rdb := redis.NewClient(info)

Just had this issue with after upgrading from 3.0.2 to 3.1.0 on heroku (Looks like fake username issue, username is 'h')

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zhangruiskyline picture zhangruiskyline  ·  7Comments

gurre picture gurre  ·  5Comments

krak3n picture krak3n  ·  4Comments

mollylogue picture mollylogue  ·  4Comments

mouhong picture mouhong  ·  3Comments