redis/redis-rb · error · ArgumentError
wrong number of arguments (given #{args.size + 2}, expected
Error message
wrong number of arguments (given #{args.size + 2}, expected 2, 5 or 6) What it means
Error "wrong number of arguments (given #{args.size + 2}, expected 2, 5 or 6)" thrown in redis/redis-rb.
Source
Thrown at lib/redis/commands/streams.rb:441
# @param key [String] the stream key
# @param group [String] the consumer group name
# @param start [String] start first entry id of range
# @param end [String] end last entry id of range
# @param count [Integer] count the number of entries as limit
# @param consumer [String] the consumer name
#
# @option opts [Integer] :idle pending message minimum idle time in milliseconds
#
# @return [Hash] the summary of pending entries
# @return [Array<Hash>] the pending entries details if options were specified
def xpending(key, group, *args, idle: nil)
command_args = [:xpending, key, group]
command_args << 'IDLE' << Integer(idle) if idle
case args.size
when 0, 3, 4
command_args.concat(args)
else
raise ArgumentError, "wrong number of arguments (given #{args.size + 2}, expected 2, 5 or 6)"
end
summary_needed = args.empty?
blk = summary_needed ? HashifyStreamPendings : HashifyStreamPendingDetails
send_command(command_args, &blk)
end
private
def _xread(args, keys, ids, blocking_timeout_msec)
keys = keys.is_a?(Array) ? keys : [keys]
ids = ids.is_a?(Array) ? ids : [ids]
args << 'STREAMS'
args.concat(keys)
args.concat(ids)
if blocking_timeout_msec.nil?
send_command(args, &HashifyStreams)View on GitHub (pinned to 2ba9010b91)
Solutions
- Call the method with 2, 5 or 6 total arguments as documented; the given count is not supported.
- Check the method signature and remove or add arguments to match one of the allowed arities.
When it happens
Trigger: Thrown at lib/redis/commands/streams.rb:441 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of redis/redis-rb@2ba9010b91 (2026-08-23).
Data as JSON: /api/errors/8bd6f185858022b3.
Report an issue: GitHub.