prestodb/presto · error · PrestoException
INVALID_FUNCTION_ARGUMENT
INVALID_FUNCTION_ARGUMENT
Error message
INVALID_FUNCTION_ARGUMENT: e (invalid regexp pattern, message carried from joni exception)
What it means
Raised in joniRegexp when constructing a joni Regex from the pattern slice fails: the joni library threw (syntax error, unsupported construct, or invalid UTF-8 bytes), and the original joni message is carried through so the faulty pattern text can be identified. Fired from castVarcharToJoniRegexp/castCharToJoniRegexp when casting a string to the Joni regexp type.
Source
Thrown at presto-main-base/src/main/java/com/facebook/presto/operator/scalar/JoniRegexpCasts.java:62
}
@ScalarOperator(OperatorType.CAST)
@LiteralParameters("x")
@SqlType(JoniRegexpType.NAME)
public static Regex castCharToJoniRegexp(@LiteralParameter("x") Long charLength, @SqlType("char(x)") Slice pattern)
{
return joniRegexp(padSpaces(pattern, charLength.intValue()));
}
public static Regex joniRegexp(Slice pattern)
{
Regex regex;
try {
// When normal UTF8 encoding instead of non-strict UTF8) is used, joni can infinite loop when invalid UTF8 slice is supplied to it.
regex = new Regex(pattern.getBytes(), 0, pattern.length(), Option.DEFAULT, NonStrictUTF8Encoding.INSTANCE, Syntax.Java);
}
catch (Exception e) {
throw new PrestoException(INVALID_FUNCTION_ARGUMENT, e);
}
return regex;
}
}
View on GitHub (pinned to 55bb57d202)
Solutions
- Fix the regexp pattern syntax (check for unbalanced parentheses, quantifiers with nothing to repeat, etc.)
- Validate the pattern with regexp_like on a sample before casting
- Ensure the input string is valid UTF-8
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at presto-main-base/src/main/java/com/facebook/presto/operator/scalar/JoniRegexpCasts.java:62 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/68d2ede3d344a8b0.
Report an issue: GitHub.