1

Sometimes i am getting following error while trying to increment value in hash field.

{ ReplyError: ERR hash value is not an integer
at parseError (/opt/node-app/node_modules/redis-parser/lib/parser.js:193:12)
at parseType (/opt/node-app/node_modules/redis-parser/lib/parser.js:303:14)
command: 'HINCRBY',
args: [ 'users:5b0598cd2f197a557e13e9d5', 'nTotalChips', 700 ],
code: 'ERR' }

My code is as follows:

redisClient.hincrby("users:5b0598cd2f197a557e13e9d5", "nTotalChips", 700, function(err, nTotalChips) {
    //some other logic        
});

I got some hint by reading that this is error due to serialization, but i didnt got where exactly it is because this error not generated all the time.

1 Answer 1

4

ERR hash value is not an integer

This is an error when you are trying to increment a hash field that's NOT an integer.

127.0.0.1:6379> hset hash field 1
(integer) 0
127.0.0.1:6379> hincrby hash field 2            // OK
(integer) 3
127.0.0.1:6379> hset hash field string-value
(integer) 0
127.0.0.1:6379> hincrby hash field 2            // ERROR
(error) ERR hash value is not an integer

It seems that some other client changed the hash field to a string value.

Sign up to request clarification or add additional context in comments.

2 Comments

Yeah, there may be chance let me check that
Thanks man, i got the accidentally i that value converted to float and that was giving that value.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.