quarkusio/quarkus · error · IllegalArgumentException

`" + name + "` must not be `null`

Error message

`" + name + "` must not be `null`

What it means

Validation.notNullOrEmpty(X[] array, String name) throws IllegalArgumentException when the generic array parameter is null. Quarkus Redis extensions use this centralized validator to fail fast with a message naming the offending parameter.

Source

Thrown at extensions/redis-client/runtime/src/main/java/io/quarkus/redis/runtime/datasource/Validation.java:15

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) {

View on GitHub (pinned to e1c734241f)

Solutions

  1. Ensure the array is non-null before calling the API
  2. Use an empty check / Optional.orElse to substitute a valid value
  3. Reorder logic so the API is not called when there is nothing to pass

Example fix

// before
String[] keys = cache.get("keys"); // may be null
redis.bfmexists(key, keys);
// after
String[] keys = cache.get("keys");
if (keys != null && keys.length > 0) redis.bfmexists(key, keys);
Defensive patterns

Strategy: type-guard

Validate before calling

if (array == null) {
    throw new IllegalArgumentException(name + " must be provided");
}

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("Missing argument: " + e.getMessage());
}

Prevention

When it happens

Trigger: Passing a null String[]/Object[] to any Redis API that validates its array arguments through Validation.notNullOrEmpty (e.g. key sets, members, field arrays).

Common situations: Null result of an upstream lookup used as an argument; optional config value left null and passed directly; refactor leaving a null default.

Related errors


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