prestodb/presto · error · PrestoException

INVALID_ARGUMENTS

INVALID_ARGUMENTS

Error message

errorMessage

What it means

Failures.checkArgument is a Guava-style assertion helper that converts a failed boolean precondition into a PrestoException with standard error code INVALID_ARGUMENTS. The thrown message is exactly the errorMessage string passed in, so every call site that uses this helper produces an error whose message originates there.

Source

Thrown at presto-main-base/src/main/java/com/facebook/presto/util/Failures.java:76

{
    private static final String NODE_CRASHED_ERROR = "The node may have crashed or be under too much load. " +
            "This is probably a transient issue, so please retry your query in a few minutes.";

    public static final String WORKER_NODE_ERROR = "Encountered too many errors talking to a worker node. " + NODE_CRASHED_ERROR;

    public static final String REMOTE_TASK_MISMATCH_ERROR = "Could not communicate with the remote task. " + NODE_CRASHED_ERROR;

    private Failures() {}

    public static ExecutionFailureInfo toFailure(Throwable failure)
    {
        return toFailure(failure, newIdentityHashSet());
    }

    public static void checkArgument(boolean expression, String errorMessage)
    {
        if (!expression) {
            throw new PrestoException(StandardErrorCode.INVALID_ARGUMENTS, errorMessage);
        }
    }

    public static void checkArgument(boolean expression, String errorMessageTemplate, Object... errorMessageArgs)
    {
        if (!expression) {
            throw new PrestoException(StandardErrorCode.INVALID_ARGUMENTS, String.format(errorMessageTemplate, errorMessageArgs));
        }
    }

    public static void checkCondition(boolean condition, ErrorCodeSupplier errorCode, String formatString, Object... args)
    {
        if (!condition) {
            throw new PrestoException(errorCode, format(formatString, args));
        }
    }

    public static List<ExecutionFailureInfo> toFailures(Collection<? extends Throwable> failures)

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Read the exception message — it is the exact errorMessage from the failing checkArgument call site; locate that call site in the Presto source to see which condition failed
  2. Correct the offending argument in your query/configuration per the violated condition
  3. Use try_cast or explicit validation in your SQL to avoid passing values that violate function preconditions
  4. If the precondition looks wrong for valid input, file an issue with a minimal reproducing query

Example fix

-- before
SELECT substr(name, -1, 0) FROM t; -- invalid args
-- after
SELECT substr(name, 1, greatest(length(name), 0)) FROM t;
Defensive patterns

Strategy: try-catch

Try / catch

try { /* presto operation */ } catch (PrestoException e) { if (e.getErrorCode().getCode() == StandardErrorCode.INVALID_ARGUMENTS.toErrorCode().getCode()) { /* fix args or surface to user */ } else throw e; }

Prevention

When it happens

Trigger: Any internal call to Failures.checkArgument(expr, msg) where expr evaluates false — commonly argument validation in functions, operators, or connectors when a caller supplies values that violate an internal invariant (wrong nullability, out-of-range parameters, incompatible types).

Common situations: Calling SQL functions with disallowed parameter values (e.g. negative lengths, zero precision); connector configuration violating invariants; library version mismatches where an assumed precondition no longer holds.

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


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/6814b88605bffe5c. Report an issue: GitHub.