quarkusio/quarkus · error · IllegalArgumentException

Aggregation + aggregate + not supported

Error message

Aggregation + aggregate + not supported

What it means

In ZAggregateArgs.toArgs(), the AGGREGATE clause serializes a chosen aggregation function (SUM, MIN, MAX). The default branch is reached when an unsupported enum/aggregate value is present, so the library throws instead of emitting an invalid command. This guards against enum values added upstream that this args class does not yet map.

Source

Thrown at extensions/redis-client/runtime/src/main/java/io/quarkus/redis/datasource/sortedset/ZAggregateArgs.java:104

            args.add("WEIGHTS");
            for (double w : weights) {
                args.add(Double.toString(w));
            }
        }
        if (aggregate != null) {
            args.add("AGGREGATE");
            switch (aggregate) {
                case SUM:
                    args.add("SUM");
                    break;
                case MIN:
                    args.add("MIN");
                    break;
                case MAX:
                    args.add("MAX");
                    break;
                default:
                    throw new IllegalArgumentException("Aggregation " + aggregate + " not supported");
            }
        }
        return args;
    }
}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Use only supported aggregation values: SUM, MIN, MAX
  2. Check the ZAggregateArgs/aggregate enum API for the exact supported constants
  3. Upgrade the quarkus-redis-client version if a newer Redis aggregation option is needed

Example fix

// before
args.aggregate(Aggregate.UNKNOWN); // falls to default branch
// after
args.aggregate(Aggregate.MIN);
Defensive patterns

Strategy: validation

Validate before calling

if (aggregate != SUM && aggregate != MIN && aggregate != MAX) throw new IllegalArgumentException("Unsupported aggregation: " + aggregate);

Type guard

boolean isSupportedAggregate(Aggregate a) { return a == Aggregate.SUM || a == Aggregate.MIN || a == Aggregate.MAX; }

Try / catch

try {
    sortedSet.zunion(args);
} catch (IllegalArgumentException e) {
    // fall back to SUM or skip the AGGREGATE clause
}

Prevention

When it happens

Trigger: Setting an aggregate value on ZAggregateArgs whose switch mapping only handles SUM/MIN/MAX (or the field holds an unexpected value), then calling toArgs().

Common situations: Custom or newly introduced aggregation enum constant not yet handled; constructing the args object reflectively or from deserialized data.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/9840efd457e39140. Report an issue: GitHub.