New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ERR wrong number of arguments for 'hmset' command #262
Comments
I found, that it is caused by local problem with project code, but the error message is really not obvious. |
Would you mind saying what the problem was? I'd be happy to make the error Cheers
|
I'm not really sure, but as I understand the problem was - node use precompiled version of the project to run. As I delete app.js.orig file it start workine just fine. But it still looks like a mistics for me. In the old version of app.js I use redis call to hash and pass an object as a parametr, but the problem was - the object has some undefined fields and it cause similar problem with redis-client. The error message was informative and show me the stack which leads to that redis call. Then I fixed this problem by removing this empty fields from th object. And I get the problem discribed above. |
One way for this error to occur is passing an integer as the first parameter of hmset. I fixed this by converting the first parameter to a string in my code. Maybe node_redis should do this automatically if the first parameter is a number? |
This is what I'm getting, not sure what I'm doing wrong. Redis docs didn't say if the key had to exist previously, so I don't think that should matter. The command works in redis-cli
Can't send an object - so I'm converting the object to the key value pairs, and still doesn't work:
|
For some reason it didn't think of the arguments was a string, I had to iterate through the object and explicitly set each key and value to a string. |
It seems only the first argument must be a string. The object with values could be numbers or strings. redis.hmset("key", {"id": 5, somekey: "someval"}); //will work |
Added toString() conversion in client.hmset(key, object, [callback]) to fix this issue. HMSET function can now accept numbers (e.g. timestamps), although they are sent to Redis as strings. See code here: https://github.com/ralexstokes/node_redis/blob/master/index.js, beginning line 1036. |
你的某一个变量名或者函数的参数名与库发生冲突了,建议该参数名就好了。 我刚刚也遇到这个问题。 |
This is fixed in newer versions. |
别说中文(don't speak Chinese in Github |
after npm update the problem appear with node-redis
node_redis: no callback to send error: Error: ERR wrong number of arguments for 'hmset' command
/var/www/node_modules/redis/index.js:475
throw err;
^
Error: Error: ERR wrong number of arguments for 'hmset' command
at HiredisReplyParser.RedisClient.init_parser (/var/www/node_modules/redis/index.js:253:27)
at HiredisReplyParser.EventEmitter.emit (events.js:88:17)
at HiredisReplyParser.execute (/var/www/node_modules/redis/lib/parser/hiredis.js:41:18)
at RedisClient.on_data (/var/www/node_modules/redis/index.js:440:27)
at Socket. (/var/www/node_modules/redis/index.js:70:14)
at Socket.EventEmitter.emit (events.js:88:17)
at TCP.onread (net.js:395:14)
I have node 0.8.8 and npm 1.1.59
The text was updated successfully, but these errors were encountered: