{"record":{"id":"6814b88605bffe5c","repo":"prestodb/presto","slug":"invalid-arguments-6814b8","errorCode":"INVALID_ARGUMENTS","errorMessage":"errorMessage","messagePattern":"errorMessage","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/util/Failures.java","lineNumber":76,"sourceCode":"{\n    private static final String NODE_CRASHED_ERROR = \"The node may have crashed or be under too much load. \" +\n            \"This is probably a transient issue, so please retry your query in a few minutes.\";\n\n    public static final String WORKER_NODE_ERROR = \"Encountered too many errors talking to a worker node. \" + NODE_CRASHED_ERROR;\n\n    public static final String REMOTE_TASK_MISMATCH_ERROR = \"Could not communicate with the remote task. \" + NODE_CRASHED_ERROR;\n\n    private Failures() {}\n\n    public static ExecutionFailureInfo toFailure(Throwable failure)\n    {\n        return toFailure(failure, newIdentityHashSet());\n    }\n\n    public static void checkArgument(boolean expression, String errorMessage)\n    {\n        if (!expression) {\n            throw new PrestoException(StandardErrorCode.INVALID_ARGUMENTS, errorMessage);\n        }\n    }\n\n    public static void checkArgument(boolean expression, String errorMessageTemplate, Object... errorMessageArgs)\n    {\n        if (!expression) {\n            throw new PrestoException(StandardErrorCode.INVALID_ARGUMENTS, String.format(errorMessageTemplate, errorMessageArgs));\n        }\n    }\n\n    public static void checkCondition(boolean condition, ErrorCodeSupplier errorCode, String formatString, Object... args)\n    {\n        if (!condition) {\n            throw new PrestoException(errorCode, format(formatString, args));\n        }\n    }\n\n    public static List<ExecutionFailureInfo> toFailures(Collection<? extends Throwable> failures)","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/util/Failures.java#L58-L94","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["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","Correct the offending argument in your query/configuration per the violated condition","Use try_cast or explicit validation in your SQL to avoid passing values that violate function preconditions","If the precondition looks wrong for valid input, file an issue with a minimal reproducing query"],"exampleFix":"-- before\nSELECT substr(name, -1, 0) FROM t; -- invalid args\n-- after\nSELECT substr(name, 1, greatest(length(name), 0)) FROM t;","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { /* presto operation */ } catch (PrestoException e) { if (e.getErrorCode().getCode() == StandardErrorCode.INVALID_ARGUMENTS.toErrorCode().getCode()) { /* fix args or surface to user */ } else throw e; }","preventionTips":["Read the exception message verbatim — it names the exact failed precondition","Validate function arguments (ranges, nullability) in SQL before calling","Use try_cast and CASE guards for data-dependent arguments"],"tags":["presto","argument-validation","presto-exception"],"backgroundTag":"invalid-argument","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}