FG
🗄️ Databases

nodejs.RangeError: Maximum call stack size exceeded when use hmset

Freshover 6 years ago
Mar 14, 20260 views
Confidence Score87%
87%

Problem

when hmset get too much args(i passed 163368 args),it will report `nodejs.RangeError: Maximum call stack size exceeded`

Error Output

Error: Maximum call stack size exceeded`

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
High Confidence Fix
84% confidence100% success rate3 verificationsLast verified Mar 14, 2026

Solution: nodejs.RangeError: Maximum call stack size exceeded when use hmset

Low Risk

I ran into this too, and I think it's mostly a documentation issue that ioredis really should address. Essentially, the ioredis APIs for `hmset`, `hmget`, and possibly others are documented as though the arguments to the command must be passed as arguments one by one. I.e., if you want to set 100,000 hash keys, the docs suggest you'd call `commander.hmset` with 200,001 arguments (200,000 for the

84

Trust Score

3 verifications

100% success
  1. 1

    I ran into this too, and I think it's mostly a documentation issue that ioredis

    I ran into this too, and I think it's mostly a documentation issue that ioredis really should address.

  2. 2

    Essentially, the ioredis APIs for `hmset`, `hmget`, and possibly others are docu

    Essentially, the ioredis APIs for `hmset`, `hmget`, and possibly others are documented as though the arguments to the command must be passed as arguments one by one. I.e., if you want to set 100,000 hash keys, the docs suggest you'd call `commander.hmset` with 200,001 arguments (200,000 for the hash keys and their values, plus one for the redis key holding the hash). But, as noted in the OP, trying to call a method with so many arguments causes v8 to crash, because each argument gets allocated as a variable in the function's stack frame.

  3. 3

    The simplest workaround is actually to call `commander.hmset("keyHoldingHash", m

    The simplest workaround is actually to call `commander.hmset("keyHoldingHash", my200_000ItemArray)`. This works because the `Command` class flattens it's arguments — which is great, but that's the part that's totally undocumented and that it's unclear whether callers can safely rely on. So, if that flattening is here to stay, it should be documented, probably with a note that it can be used with any command to work around this limit on the number of arguments allowed to a function call.

Validation

Resolved in redis/ioredis GitHub issue #801. Community reactions: 2 upvotes.

Verification Summary

Worked: 3
Last verified Mar 14, 2026

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

redisiorediscache