quarkusio/quarkus · error · IllegalArgumentException
`" + name + "` must not be empty
Error message
`" + name + "` must not be empty
What it means
The same generic-array Validation.notNullOrEmpty overload throws "`<name>` must not be empty" when the array is non-null but has length 0. Redis commands cannot be built from zero arguments, so empty arrays are rejected like nulls.
Source
Thrown at extensions/redis-client/runtime/src/main/java/io/quarkus/redis/runtime/datasource/Validation.java:18
package io.quarkus.redis.runtime.datasource;
import java.time.Duration;
import java.util.Collection;
import java.util.Map;
public class Validation {
private Validation() {
// avoid direct instantiation
}
public static <X> X[] notNullOrEmpty(X[] array, String name) {
if (array == null) {
throw new IllegalArgumentException("`" + name + "` must not be `null`");
}
if (array.length == 0) {
throw new IllegalArgumentException("`" + name + "` must not be empty");
}
return array;
}
public static float[] notNullOrEmpty(float[] array, String name) {
if (array == null) {
throw new IllegalArgumentException("`" + name + "` must not be `null`");
}
if (array.length == 0) {
throw new IllegalArgumentException("`" + name + "` must not be empty");
}
return array;
}
public static double[] notNullOrEmpty(double[] array, String name) {
if (array == null) {
throw new IllegalArgumentException("`" + name + "` must not be `null`");
}View on GitHub (pinned to e1c734241f)
Solutions
- Guard for array.length == 0 (or collection.isEmpty()) before calling
- Skip the call or use a batched API that tolerates empties
- Return early when the source collection is empty
Example fix
// before
redis.bfmexists(key, members.toArray(new String[0]));
// after
if (!members.isEmpty()) {
redis.bfmexists(key, members.toArray(new String[0]));
} Defensive patterns
Strategy: validation
Validate before calling
if (array == null || array.length == 0) {
throw new IllegalArgumentException(name + " must contain at least one element");
} Type guard
static <X> boolean hasArray(X[] array) {
return array != null && array.length > 0;
} Try / catch
try {
api.call(key, array);
} catch (IllegalArgumentException e) {
log.error("Empty argument: " + e.getMessage());
} Prevention
- Check collection.isEmpty() before toArray()
- Skip calls for empty batches
- Document minimum arity of Redis APIs
When it happens
Trigger: Calling a Redis API with new String[0] or a List.toArray() of an empty collection, e.g. bloom filter members or hash field arrays validated via this overload.
Common situations: Empty collection from a filter/stream operation with no matches; upstream data absent producing an empty list; loop-driven batch where the first batch is empty.
Related errors
- `count` must be strictly positive
- `timeout` must be positive
- `timeout` must not be `null`
- `timestamp` must not be `null`
- Channel cannot be blank
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/445aef59f9ba5b8f.
Report an issue: GitHub.