redis/redis-rb · error · ArgumentError

Pick either LEFT or RIGHT

Error message

Pick either LEFT or RIGHT

What it means

Error "Pick either LEFT or RIGHT" thrown in redis/redis-rb.

Source

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

      #
      # @example Popping a element
      #   redis.blmpop(1.0, 'list')
      #   #=> ['list', ['a']]
      # @example With count option
      #   redis.blmpop(1.0, 'list', count: 2)
      #   #=> ['list', ['a', 'b']]
      #
      # @params timeout [Float] a float value specifying the maximum number of seconds to block) elapses.
      #   A timeout of zero can be used to block indefinitely.
      # @params key [String, Array<String>] one or more keys with lists
      # @params modifier [String]
      #  - when `"LEFT"` - the elements popped are those from the left of the list
      #  - when `"RIGHT"` - the elements popped are those from the right of the list
      # @params count [Integer] a number of elements to pop
      #
      # @return [Array<String, Array<String, Float>>] list of popped elements or nil
      def blmpop(timeout, *keys, modifier: "LEFT", count: nil)
        raise ArgumentError, "Pick either LEFT or RIGHT" unless modifier == "LEFT" || modifier == "RIGHT"

        args = [:blmpop, timeout, keys.size, *keys, modifier]
        args << "COUNT" << Integer(count) if count

        send_blocking_command(args, timeout)
      end

      # Pops one or more elements from the first non-empty list key from the list
      # of provided key names.
      #
      # @example Popping a element
      #   redis.lmpop('list')
      #   #=> ['list', ['a']]
      # @example With count option
      #   redis.lmpop('list', count: 2)
      #   #=> ['list', ['a', 'b']]
      #
      # @params key [String, Array<String>] one or more keys with lists

View on GitHub (pinned to 2ba9010b91)

Solutions

  1. Pass either :left or :right as the where argument, not both and not neither.
  2. Use where: :left to pop from the source and push to the head, or where: :right for the tail.

When it happens

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