IllegalArgumentException is thrown deliberately, by a method that examined an argument and rejected it: a negative size, an empty string where content is required, a number outside a documented range, a malformed identifier. Unlike most exceptions on this site, nobody's environment is broken; the library is reporting a contract violation by its caller. The stack trace's top frames name the method that rejected the value, and the message usually states the rule, so the fix is to find which argument, on that call, broke which rule.
UUID.fromString, enum valueOf with a name that matches no constant (case matters), date/time formatters fed a string in the wrong pattern, Integer.parseInt on empty text (that one is the subclass NumberFormatException).What is the difference between IllegalArgumentException and IllegalStateException? Argument: the caller passed a bad value, wrong regardless of timing. State: the object's current state makes the call inappropriate (already closed, not yet initialized), the arguments may be fine. The distinction points at who is responsible, the input or the lifecycle.
Is NumberFormatException related? It extends IllegalArgumentException; parsing text into a number is argument validation. The remedies are the same: check the input before or handle the rejection where the text originates.
Should my code throw it or return an error? For programming errors (a caller violating a documented contract), throwing is right, it should be fixed in development. For expected user-input problems, validate earlier and report in the interface, reserving the exception for cases that slip through.