eclipse-vertx/vert.x · error · IllegalArgumentException
${message}
Error message
${message} What it means
Arguments.require is a precondition helper: it throws IllegalArgumentException with the caller-provided message when the given boolean condition is false. It is the library-wide way to reject invalid method arguments.
Source
Thrown at vertx-core/src/main/java/io/vertx/core/impl/Arguments.java:29
package io.vertx.core.impl;
/**
* Helper class to perform extended checks on arguments analogous to
* {@link java.util.Objects#requireNonNull(Object, String)}.
*/
public class Arguments {
/**
* Checks that the specified condition is fulfilled and throws a customized {@link IllegalArgumentException} if it
* is {@code false}.
* @param condition condition which must be fulfilled
* @param message detail message to be used in the event that a {@code
* IllegalArgumentException} is thrown
*/
public static void require(boolean condition, String message) {
if (!condition) {
throw new IllegalArgumentException(message);
}
}
/**
* Checks that the specified number is within the specified minimum and maximum range (inclusively) and throws a
* customized {@link IllegalArgumentException} if not.
* @param number value to check
* @param min minimum allowed value
* @param max maximum allowed value
* @param message detail message to be used in the event that a {@code
* IllegalArgumentException} is thrown
*/
public static void requireInRange(int number, int min, int max, String message) {
if (number < min || number > max) {
throw new IllegalArgumentException(message);
}
}
View on GitHub (pinned to fb308bd8c3)
Solutions
- Read the exception message (it is caller-supplied) to see which precondition failed
- Fix the arguments at the call site to satisfy the documented contract
- Add your own validation before calling the API to fail early with context
Example fix
// before new DeploymentOptions(options == null ? null : options.toJson()); // NPE / require failure deep inside // after Objects.requireNonNull(options, "options must not be null"); new DeploymentOptions(options.toJson());
Defensive patterns
Strategy: try-catch
Validate before calling
Objects.requireNonNull(options, "options must not be null");
Type guard
static <T> T notNull(T v, String name){ if (v == null) throw new IllegalArgumentException(name + " must not be null"); return v; } Try / catch
try { api.call(x); } catch (IllegalArgumentException e) { log.error("Bad argument: {}", e.getMessage()); } Prevention
- Read the exception message — it names the violated precondition
- Validate inputs before invoking Vert.x APIs
- Keep API docs handy for argument contracts when upgrading versions
When it happens
Trigger: Any Vert.x internal or user call to Arguments.require(false, msg) — i.e. an API contract was violated: null/empty required value, out-of-contract flag, or caller passing arguments the method forbids.
Common situations: Passing null or blank strings to APIs validated with require; constructing Vert.x objects before required dependencies are set; upgrading Vert.x where new argument validation was added.
Understand the failure class
Background: "must be a positive integer", "cannot be empty", "invalid argument": how invalid-argument errors work across open-source libraries — this error's family across 33 libraries.
Related errors
- code: <statusCode> (expected: 0+)
- streamIdleTimeout must be >= 0
- streamReadIdleTimeout must be >= 0
- streamWriteIdleTimeout must be >= 0
- Invalid authority host portion:
AI-assisted analysis of eclipse-vertx/vert.x@fb308bd8c3 (2026-09-06).
Data as JSON: /api/errors/9a069002725f4f33.
Report an issue: GitHub.