{"record":{"id":"445aef59f9ba5b8f","repo":"quarkusio/quarkus","slug":"name-must-not-be-empty","errorCode":null,"errorMessage":"`\" + name + \"` must not be empty","messagePattern":"`\" \\+ name \\+ \"` must not be empty","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions/redis-client/runtime/src/main/java/io/quarkus/redis/runtime/datasource/Validation.java","lineNumber":18,"sourceCode":"package io.quarkus.redis.runtime.datasource;\n\nimport java.time.Duration;\nimport java.util.Collection;\nimport java.util.Map;\n\npublic class Validation {\n\n    private Validation() {\n        // avoid direct instantiation\n    }\n\n    public static <X> X[] notNullOrEmpty(X[] array, String name) {\n        if (array == null) {\n            throw new IllegalArgumentException(\"`\" + name + \"` must not be `null`\");\n        }\n        if (array.length == 0) {\n            throw new IllegalArgumentException(\"`\" + name + \"` must not be empty\");\n        }\n        return array;\n    }\n\n    public static float[] notNullOrEmpty(float[] array, String name) {\n        if (array == null) {\n            throw new IllegalArgumentException(\"`\" + name + \"` must not be `null`\");\n        }\n        if (array.length == 0) {\n            throw new IllegalArgumentException(\"`\" + name + \"` must not be empty\");\n        }\n        return array;\n    }\n\n    public static double[] notNullOrEmpty(double[] array, String name) {\n        if (array == null) {\n            throw new IllegalArgumentException(\"`\" + name + \"` must not be `null`\");\n        }","sourceCodeStart":1,"sourceCodeEnd":36,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/redis-client/runtime/src/main/java/io/quarkus/redis/runtime/datasource/Validation.java#L1-L36","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nredis.bfmexists(key, members.toArray(new String[0]));\n// after\nif (!members.isEmpty()) {\n    redis.bfmexists(key, members.toArray(new String[0]));\n}","handlingStrategy":"validation","validationCode":"if (array == null || array.length == 0) {\n    throw new IllegalArgumentException(name + \" must contain at least one element\");\n}","typeGuard":"static <X> boolean hasArray(X[] array) {\n    return array != null && array.length > 0;\n}","tryCatchPattern":"try {\n    api.call(key, array);\n} catch (IllegalArgumentException e) {\n    log.error(\"Empty argument: \" + e.getMessage());\n}","preventionTips":["Check collection.isEmpty() before toArray()","Skip calls for empty batches","Document minimum arity of Redis APIs"],"tags":["validation","empty-collection","redis","illegal-argument"],"backgroundTag":"empty-required-collection","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}