redis/redis-rb · error · ArgumentError

order requires count or exactly

Error message

order requires count or exactly

What it means

Error "order requires count or exactly" thrown in redis/redis-rb.

Source

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

          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"
          raise ArgumentError, "where_source must be 'LEFT' or 'RIGHT'"
        end

        if where_destination != "LEFT" && where_destination != "RIGHT"
          raise ArgumentError, "where_destination must be 'LEFT' or 'RIGHT'"
        end

        [where_source, where_destination]

View on GitHub (pinned to 2ba9010b91)

Solutions

  1. When passing order:, also pass count: or exactly: so the ordering has a defined element count to operate on.
  2. Remove the order: option if you do not need ordered retrieval.

When it happens

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