pinpoint-apm/pinpoint · error · IllegalArgumentException
Webhook URL port is not valid
Error message
Webhook URL port is not valid
What it means
WebhookUrlValidator.validateAuthority throws IllegalArgumentException when the port is unusable: an explicit ':' port that fails to parse (getPort()==-1 while hasExplicitPort is true), port 0, or a port above MAX_PORT (65535). The validator rejects ambiguous or out-of-range ports.
Solutions
- Fix or remove the port: use 'https://example.com/hook' for default ports or a valid number 1-65535
- Substitute config placeholders (e.g. :${PORT}) with the actual port number before validating
- Verify the port is an integer within 1-65535
Example fix
// before
validator.validateSyntax("https://example.com:${PORT}/webhook");
// after
validator.validateSyntax("https://example.com:8443/webhook"); Defensive patterns
Strategy: validation
Validate before calling
java.net.URI u = java.net.URI.create(url); int p = u.getPort(); if (p == 0 || p > 65535 || (p == -1 && url.matches(".*:[^/].*"))) reject(url); Type guard
boolean hasValidPort(java.net.URI uri) { int p = uri.getPort(); return p == -1 || (p > 0 && p <= 65535); } Try / catch
try { WebhookUrlValidator.validateSyntax(url); } catch (IllegalArgumentException e) { if (e.getMessage().contains("port")) { reject or fix port; } } Prevention
- Resolve config placeholders like :${PORT} before validating
- Omit the port entirely for default ports (80/443)
- Validate port range 1-65535 at the config boundary
When it happens
Trigger: URLs like 'https://example.com:/hook' (colon with no number, or non-numeric), 'http://example.com:0/', 'http://example.com:99999/' passed to validateSyntax/uri.
Common situations: Typo leaving a dangling colon after the host; config placeholder not substituted (e.g. :${PORT} or :0); hand-written port exceeding 65535.
Understand the failure class
Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.
Related errors
- Malformed webhook URL
- Webhook URL fragment is not allowed
- Webhook URL host is required
- Webhook URL is required
- Webhook URL scheme is required
AI-assisted analysis of pinpoint-apm/pinpoint@744c3d3075 (2026-09-07).
Data as JSON: /api/errors/686ff7ce77587e0d.
Report an issue: GitHub.
Appendix: source
Thrown at commons-server/src/main/java/com/navercorp/pinpoint/common/server/webhook/WebhookUrlValidator.java:133
}
}
private static void validateAuthority(URI uri) {
if (uri.getHost() == null || uri.getHost().isBlank()) {
throw new IllegalArgumentException("Webhook URL host is required");
}
if (isBlockedHostLiteral(uri.getHost())) {
throw new IllegalArgumentException("Webhook URL host is not allowed");
}
if (uri.getRawUserInfo() != null) {
throw new IllegalArgumentException("Webhook URL user info is not allowed");
}
if (uri.getRawFragment() != null) {
throw new IllegalArgumentException("Webhook URL fragment is not allowed");
}
int port = uri.getPort();
if (port == -1 && hasExplicitPort(uri)) {
throw new IllegalArgumentException("Webhook URL port is not valid");
}
if (port == 0 || port > MAX_PORT) {
throw new IllegalArgumentException("Webhook URL port is not allowed");
}
}
private static boolean hasExplicitPort(URI uri) {
String rawAuthority = uri.getRawAuthority();
if (rawAuthority == null || rawAuthority.isEmpty()) {
return false;
}
int hostStartIndex = rawAuthority.lastIndexOf('@') + 1;
if (rawAuthority.charAt(hostStartIndex) == '[') {
int hostEndIndex = rawAuthority.indexOf(']', hostStartIndex);
return hostEndIndex >= 0
&& hostEndIndex + 1 < rawAuthority.length()
&& rawAuthority.charAt(hostEndIndex + 1) == ':';View on GitHub (pinned to 744c3d3075)