eclipse-vertx/vert.x · error · IllegalArgumentException
unterminated escape sequence at end of string: ${s}
Error message
unterminated escape sequence at end of string: ${s} What it means
URI decoding failure in decodeAndTransformURIComponent: a percent sign appears as the last character of the string, so the escape sequence has no following hex digits to decode. The full offending string is included; the input at fault is the URI component being decoded.
Source
Thrown at vertx-core/src/main/java/io/vertx/core/internal/net/RFC3986.java:81
private static int indexOfPercentOrPlus(String s) {
for (int i = 0, size = s.length(); i < size; i++) {
final char c = s.charAt(i);
if (c == '%' || c == '+') {
return i;
}
}
return -1;
}
private static String decodeAndTransformURIComponent(String s, int i, boolean plus) {
final byte[] buf = s.getBytes(StandardCharsets.UTF_8);
int pos = i; // position in `buf'.
for (int size = s.length(); i < size; i++) {
char c = s.charAt(i);
if (c == '%') {
if (i == size - 1) {
throw new IllegalArgumentException("unterminated escape"
+ " sequence at end of string: " + s);
}
c = s.charAt(++i);
if (c == '%') {
buf[pos++] = '%'; // "%%" -> "%"
break;
}
if (i >= size - 1) {
throw new IllegalArgumentException("partial escape"
+ " sequence at end of string: " + s);
}
c = decodeHexNibble(c);
final char c2 = decodeHexNibble(s.charAt(++i));
if (c == Character.MAX_VALUE || c2 == Character.MAX_VALUE) {
throw new IllegalArgumentException(
"invalid escape sequence `%" + s.charAt(i - 1)
+ s.charAt(i) + "' at index " + (i - 2)
+ " of: " + s);View on GitHub (pinned to fb308bd8c3)
Solutions
- Fix the truncated percent-encoding or encode lone '%' as '%25'
- Validate/normalize URIs from untrusted sources before decoding
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at vertx-core/src/main/java/io/vertx/core/internal/net/RFC3986.java:81 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of eclipse-vertx/vert.x@fb308bd8c3 (2026-09-06).
Data as JSON: /api/errors/85ac77a4fa9df9fd.
Report an issue: GitHub.