redis/jedis · error · IllegalArgumentException

Ordering (OBO or BULK) must not be null.

Error message

Ordering (OBO or BULK) must not be null.

What it means

LMoveMParams.count(int, ListMoveOrder) supports LMPOP-style multi-list moves with an ordering that maps to Redis semantics (one-by-one vs bulk). Passing a null ListMoveOrder is rejected immediately with this IllegalArgumentException because the order must be encoded into the command arguments.

Solutions

  1. Pass an explicit ListMoveOrder value (e.g. ListMoveOrder.OBO or ListMoveOrder.BULK) to count()
  2. Default the order variable before the call, e.g. order == null ? ListMoveOrder.OBO : order
  3. If order is parsed from input, fail earlier with a clear message on unknown values

Example fix

// before
ListMoveOrder order = parseOrder(input); // may return null
params.count(3, order);
// after
ListMoveOrder order = parseOrder(input);
params.count(3, order != null ? order : ListMoveOrder.OBO);
Defensive patterns

Strategy: validation

Validate before calling

if (order == null) order = ListMoveOrder.OBO;
params.count(n, order);

Type guard

ListMoveOrder nonNullOrDefault(ListMoveOrder o) { return o != null ? o : ListMoveOrder.OBO; }

Try / catch

try {
  params.count(n, order);
} catch (IllegalArgumentException e) {
  params.count(n, ListMoveOrder.OBO);
}

Prevention

When it happens

Trigger: Calling lmove-m/LMoveMParams.count(n, order) with a null order, typically when the order comes from a variable, config, or an enum lookup (ListMoveOrder.valueOf) that returned null or was defaulted to null.

Common situations: Mapping user/CLI input to ListMoveOrder with an unmatched branch leaving null; deserializing config where the order key is absent; passing a method parameter straight through without a default.

Related errors


AI-assisted analysis of redis/jedis@6dac31d4c2 (2026-09-08). Data as JSON: /api/errors/322df2b4bf9fffc0. Report an issue: GitHub.

Appendix: source

Thrown at src/main/java/redis/clients/jedis/params/LMoveMParams.java:36

 */
public class LMoveMParams implements IParams {

  private Keyword selector;
  private Integer count;
  private ListMoveOrder order;

  public static LMoveMParams lMoveMParams() {
    return new LMoveMParams();
  }

  /**
   * Move up to {@code count} elements (same semantics as the {@code count} argument of
   * {@code LPOP}), ordered by {@code order}. Mutually exclusive with
   * {@link #exactly(int, ListMoveOrder)} (last call wins).
   */
  public LMoveMParams count(int count, ListMoveOrder order) {
    if (order == null) {
      throw new IllegalArgumentException("Ordering (OBO or BULK) must not be null.");
    }
    this.selector = Keyword.COUNT;
    this.count = count;
    this.order = order;
    return this;
  }

  /**
   * Move exactly {@code count} elements, or nothing (a {@code null} reply) if the source list does
   * not hold that many, ordered by {@code order}. Mutually exclusive with
   * {@link #count(int, ListMoveOrder)} (last call wins).
   */
  public LMoveMParams exactly(int count, ListMoveOrder order) {
    if (order == null) {
      throw new IllegalArgumentException("Ordering (OBO or BULK) must not be null.");
    }
    this.selector = Keyword.EXACTLY;
    this.count = count;

View on GitHub (pinned to 6dac31d4c2)