redis/redis-rb · error · ArgumentError

wrong number of arguments

Error message

wrong number of arguments

What it means

Error "wrong number of arguments" thrown in redis/redis-rb.

Source

Thrown at lib/redis/commands/sorted_sets.rb:72

        command = [:zadd, key]
        command << "NX" if nx
        command << "XX" if xx
        command << "LT" if lt
        command << "GT" if gt
        command << "CH" if ch
        command << "INCR" if incr

        if args.size == 1 && args[0].is_a?(Array)
          members_to_add = args[0]
          return 0 if members_to_add.empty?

          # Variadic: return float if INCR, integer if !INCR
          send_command(command + members_to_add, &(incr ? Floatify : nil))
        elsif args.size == 2
          # Single pair: return float if INCR, boolean if !INCR
          send_command(command + args, &(incr ? Floatify : Boolify))
        else
          raise ArgumentError, "wrong number of arguments"
        end
      end

      # Increment the score of a member in a sorted set.
      #
      # @example
      #   redis.zincrby("zset", 32.0, "a")
      #     # => 64.0
      #
      # @param [String] key
      # @param [Float] increment
      # @param [String] member
      # @return [Float] score of the member after incrementing it
      def zincrby(key, increment, member)
        send_command([:zincrby, key, increment, member], &Floatify)
      end

      # Remove one or more members from a sorted set.

View on GitHub (pinned to 2ba9010b91)

Solutions

  1. Call the method with the documented number of arguments; check the method signature for the correct arity.
  2. Remove extra arguments or add the missing one at the call site.

When it happens

Trigger: Thrown at lib/redis/commands/sorted_sets.rb:72 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/e37af8c03d6c7eb3. Report an issue: GitHub.