pinpoint-apm/pinpoint · error · IllegalArgumentException
Malformed webhook URL
Error message
Malformed webhook URL
What it means
WebhookUrlValidator.validateUriSyntax throws IllegalArgumentException (wrapping the original URISyntaxException) when the URL string cannot be parsed as a URI with a valid server authority, e.g. new URI(url).parseServerAuthority() fails. The URL is syntactically malformed.
Source
Thrown at commons-server/src/main/java/com/navercorp/pinpoint/common/server/webhook/WebhookUrlValidator.java:97
return uri.toString();
}
public static String validateSyntax(String url) {
return validateUriSyntax(url).toString();
}
private static URI validateUriSyntax(String url) {
if (url == null || url.isBlank()) {
throw new IllegalArgumentException("Webhook URL is required");
}
final URI uri;
try {
uri = new URI(url).normalize().parseServerAuthority();
} catch (URISyntaxException e) {
throw new IllegalArgumentException("Malformed webhook URL", e);
}
validateScheme(uri);
validateAuthority(uri);
return uri;
}
private static void validateScheme(URI uri) {
String scheme = uri.getScheme();
if (scheme == null) {
throw new IllegalArgumentException("Webhook URL scheme is required");
}
String normalizedScheme = scheme.toLowerCase(Locale.ROOT);
if (!"http".equals(normalizedScheme) && !"https".equals(normalizedScheme)) {
throw new IllegalArgumentException("Webhook URL scheme must be http or https");
}View on GitHub (pinned to 744c3d3075)
Solutions
- Fix the URL syntax: ensure scheme://host[:port]/path with legal characters
- URL-encode special characters in path/query (e.g. spaces -> %20)
- Use a URI builder or the original error message (getCause is URISyntaxException) to locate the offending character index
Example fix
// before
validator.validateSyntax("http://example.com/my webhook");
// after
validator.validateSyntax("http://example.com/my%20webhook"); Defensive patterns
Strategy: validation
Validate before calling
try { new java.net.URI(url).parseServerAuthority(); } catch (java.net.URISyntaxException e) { /* reject */ } Try / catch
try { WebhookUrlValidator.validateSyntax(url); } catch (IllegalArgumentException e) { Throwable cause = e.getCause(); if (cause instanceof URISyntaxException use) { log.error("bad URL at index {}", use.getIndex()); } } Prevention
- URL-encode special characters before storing webhook URLs
- Use a URI builder instead of string concatenation to compose URLs
- Inspect URISyntaxException index in the cause to pinpoint the bad character
When it happens
Trigger: Passing strings like 'http:/missing-host', 'http://exa mple.com', 'http://[bad-ipv6', or any string with illegal characters/unbalanced brackets to validateSyntax/uri.
Common situations: Hand-edited webhook config with a typo; URL copied with stray spaces or unencoded characters; missing double slash after scheme; unencoded special characters like '|' or spaces in the URL.
Understand the failure class
Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- Webhook URL is required
- Webhook URL fragment is not allowed
- Webhook URL scheme is required
- Webhook URL scheme must be http or https
- Webhook URL host is required
AI-assisted analysis of pinpoint-apm/pinpoint@744c3d3075 (2026-09-07).
Data as JSON: /api/errors/99acf9db1a412287.
Report an issue: GitHub.