apache/seatunnel · error · IllegalArgumentException
PostHog option 'base_url' must not be blank
Error message
PostHog option 'base_url' must not be blank
What it means
PostHogSourceParameter.normalizeBaseUrl() first requires base_url to be non-blank via requireNonBlank, then strips trailing slashes. If stripping slashes leaves an empty string (input was only slashes, e.g. '///'), it throws IllegalArgumentException with this message, since an API host is mandatory to build the request URL.
Source
Thrown at seatunnel-connectors-v2/connector-http/connector-http-posthog/src/main/java/org/apache/seatunnel/connectors/seatunnel/posthog/source/config/PostHogSourceParameter.java:85
body.put("query", queryRequest);
body.put("refresh", "blocking");
setBody(JsonUtils.toJsonString(body));
setRetry(pluginConfig.getOptional(HttpCommonOptions.RETRY).orElse(0));
setRetryBackoffMultiplierMillis(
pluginConfig.get(HttpCommonOptions.RETRY_BACKOFF_MULTIPLIER_MS));
setRetryBackoffMaxMillis(pluginConfig.get(HttpCommonOptions.RETRY_BACKOFF_MAX_MS));
setConnectTimeoutMs(pluginConfig.get(HttpSourceOptions.CONNECT_TIMEOUT_MS));
setSocketTimeoutMs(pluginConfig.get(HttpSourceOptions.SOCKET_TIMEOUT_MS));
}
private static String normalizeBaseUrl(String baseUrl) {
String normalized = requireNonBlank(baseUrl, "base_url");
while (normalized.endsWith("/")) {
normalized = normalized.substring(0, normalized.length() - 1);
}
if (normalized.isEmpty()) {
throw new IllegalArgumentException("PostHog option 'base_url' must not be blank");
}
return normalized;
}
private static String encodePathSegment(String value) {
try {
return URLEncoder.encode(value, "UTF-8").replace("+", "%20");
} catch (UnsupportedEncodingException e) {
throw new IllegalStateException("UTF-8 encoding is not available", e);
}
}
private static void setHeader(Map<String, String> headers, String name, String value) {
headers.keySet().removeIf(headerName -> headerName.equalsIgnoreCase(name));
headers.put(name, value);
}
private static String requireNonBlank(String value, String optionName) {View on GitHub (pinned to cf67b549a7)
Solutions
- Set base_url to a full PostHog API host, e.g. 'https://us.posthog.com' or 'https://eu.posthog.com'.
- Check the env variable or placeholder feeding base_url is actually populated at runtime.
- Ensure no trailing-slash-only value is passed; the connector only trims trailing slashes, it cannot infer a host.
Example fix
// before
base_url = "${POSTHOG_URL}" // env var unset -> blank
// after
base_url = "https://us.posthog.com" Defensive patterns
Strategy: validation
Validate before calling
String baseUrl = config.getString("base_url");
if (baseUrl == null || baseUrl.trim().replaceAll("/+", "").isEmpty()) {
throw new IllegalArgumentException("base_url must be a full PostHog API host, e.g. https://us.posthog.com");
} Prevention
- Always set base_url to a complete host including scheme (https://...).
- Check env-var interpolation resolves before job submission.
- Never use '/' or empty placeholders as base_url values.
When it happens
Trigger: Configuring base_url as null, empty, whitespace-only, or composed entirely of '/' characters in the PostHog source config; the check runs when the parameter object is built via buildWithConfig -> baseUrl().
Common situations: Placeholder config value never replaced ('' or '${BASE_URL}' resolved to empty), env-var interpolation yielding blank, or a config typo like base_url = "/".
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- PostHog option '${optionName}' must not be blank
- Schema config can not be empty
- Unknown format type:
- Option '${option}' cannot be blank
- Option '${valuesAndOptions[index + 1]}' is not valid for the
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/9877b4a7d51c9713.
Report an issue: GitHub.