{"record":{"id":"86572b49511143a4","repo":"redis/redis-rb","slug":"pick-either-min-or-max","errorCode":null,"errorMessage":"Pick either MIN or MAX","messagePattern":"Pick either MIN or MAX","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/redis/commands/sorted_sets.rb","lineNumber":189,"sourceCode":"      #\n      # @example Popping a member\n      #   redis.bzmpop('zset')\n      #   #=> ['zset', ['a', 1.0]]\n      # @example With count option\n      #   redis.bzmpop('zset', count: 2)\n      #   #=> ['zset', [['a', 1.0], ['b', 2.0]]\n      #\n      # @params timeout [Float] a float value specifying the maximum number of seconds to block) elapses.\n      #   A timeout of zero can be used to block indefinitely.\n      # @params key [String, Array<String>] one or more keys with sorted sets\n      # @params modifier [String]\n      #  - when `\"MIN\"` - the elements popped are those with lowest scores\n      #  - when `\"MAX\"` - the elements popped are those with the highest scores\n      # @params count [Integer] a number of members to pop\n      #\n      # @return [Array<String, Array<String, Float>>] list of popped elements and scores\n      def bzmpop(timeout, *keys, modifier: \"MIN\", count: nil)\n        raise ArgumentError, \"Pick either MIN or MAX\" unless modifier == \"MIN\" || modifier == \"MAX\"\n\n        args = [:bzmpop, timeout, keys.size, *keys, modifier]\n        args << \"COUNT\" << Integer(count) if count\n\n        send_blocking_command(args, timeout) do |response|\n          response&.map do |entry|\n            case entry\n            when String then entry\n            when Array then entry.map { |pair| FloatifyPairs.call(pair) }.flatten(1)\n            end\n          end\n        end\n      end\n\n      # Removes and returns up to count members with scores in the sorted set stored at key.\n      #\n      # @example Popping a member\n      #   redis.zmpop('zset')","sourceCodeStart":171,"sourceCodeEnd":207,"githubUrl":"https://github.com/redis/redis-rb/blob/2ba9010b91dab9e0fde1fbae3a9aae003f8bc307/lib/redis/commands/sorted_sets.rb#L171-L207","documentation":"Error \"Pick either MIN or MAX\" thrown in redis/redis-rb.","triggerScenarios":"Thrown at lib/redis/commands/sorted_sets.rb:189 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass either :min or :max as the aggregate/endpoint option, not both.","Split the call into two separate calls if you need both MIN and MAX results."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2ba9010b91dab9e0fde1fbae3a9aae003f8bc307","analyzedAt":"2026-08-23T03:54:57.017Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}