{"record":{"id":"9a069002725f4f33","repo":"eclipse-vertx/vert.x","slug":"message","errorCode":null,"errorMessage":"${message}","messagePattern":"\\$\\{message\\}","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"vertx-core/src/main/java/io/vertx/core/impl/Arguments.java","lineNumber":29,"sourceCode":"\npackage io.vertx.core.impl;\n\n/**\n * Helper class to perform extended checks on arguments analogous to\n * {@link java.util.Objects#requireNonNull(Object, String)}.\n */\npublic class Arguments {\n\n  /**\n   * Checks that the specified condition is fulfilled and throws a customized {@link IllegalArgumentException} if it\n   * is {@code false}.\n   * @param condition condition which must be fulfilled\n   * @param message detail message to be used in the event that a {@code\n   * IllegalArgumentException} is thrown\n   */\n  public static void require(boolean condition, String message) {\n    if (!condition) {\n      throw new IllegalArgumentException(message);\n    }\n  }\n\n  /**\n   * Checks that the specified number is within the specified minimum and maximum range (inclusively) and throws a\n   * customized {@link IllegalArgumentException} if not.\n   * @param number value to check\n   * @param min minimum allowed value\n   * @param max maximum allowed value\n   * @param message detail message to be used in the event that a {@code\n   * IllegalArgumentException} is thrown\n   */\n  public static void requireInRange(int number, int min, int max, String message) {\n    if (number < min || number > max) {\n      throw new IllegalArgumentException(message);\n    }\n  }\n","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/eclipse-vertx/vert.x/blob/fb308bd8c3f12c79f4ae89bef67fadf6c80d036e/vertx-core/src/main/java/io/vertx/core/impl/Arguments.java#L11-L47","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nnew DeploymentOptions(options == null ? null : options.toJson()); // NPE / require failure deep inside\n// after\nObjects.requireNonNull(options, \"options must not be null\");\nnew DeploymentOptions(options.toJson());","handlingStrategy":"try-catch","validationCode":"Objects.requireNonNull(options, \"options must not be null\");","typeGuard":"static <T> T notNull(T v, String name){ if (v == null) throw new IllegalArgumentException(name + \" must not be null\"); return v; }","tryCatchPattern":"try { api.call(x); } catch (IllegalArgumentException e) { log.error(\"Bad argument: {}\", e.getMessage()); }","preventionTips":["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"],"tags":["precondition","illegal-argument","validation"],"backgroundTag":"invalid-argument","analyzedSha":"fb308bd8c3f12c79f4ae89bef67fadf6c80d036e","analyzedAt":"2026-09-06T11:37:12.241Z","contentChangedAt":"2026-09-06T11:37:12.241Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}