redis/redis-rb · error · ArgumentError

Pick either count or exactly, not both

Error message

Pick either count or exactly, not both

What it means

Error "Pick either count or exactly, not both" thrown in redis/redis-rb.

Source

Thrown at lib/redis/commands/lists.rb:402

      def _bpop(cmd, args, &blk)
        timeout = if args.last.is_a?(Hash)
          options = args.pop
          options[:timeout]
        end

        timeout ||= 0
        unless timeout.is_a?(Integer) || timeout.is_a?(Float)
          raise ArgumentError, "timeout must be an Integer or Float, got: #{timeout.class}"
        end

        args.flatten!(1)
        command = [cmd].concat(args)
        command << timeout
        send_blocking_command(command, timeout, &blk)
      end

      def _movem_amount_args(count, exactly, order)
        raise ArgumentError, "Pick either count or exactly, not both" if count && exactly

        if count || exactly
          order = order.to_s.upcase
          raise ArgumentError, "order must be 'OBO' or 'BULK'" if order != "OBO" && order != "BULK"

          [count ? "COUNT" : "EXACTLY", Integer(count || exactly), order]
        elsif order
          raise ArgumentError, "order requires count or exactly"
        else
          []
        end
      end

      def _normalize_move_wheres(where_source, where_destination)
        where_source      = where_source.to_s.upcase
        where_destination = where_destination.to_s.upcase

        if where_source != "LEFT" && where_source != "RIGHT"

View on GitHub (pinned to 2ba9010b91)

Solutions

  1. Pass either count: or exactly: to the command, not both.
  2. Remove one of the two keyword arguments; use count for an upper bound or exactly for an exact number of elements.

When it happens

Trigger: Thrown at lib/redis/commands/lists.rb:402 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/de66aa64c5dc42a9. Report an issue: GitHub.