apache/seatunnel · error · SeaTunnelException

Invalid Firebase REST URI constructed. Check parameter forma

Error message

Invalid Firebase REST URI constructed. Check parameter formatting.

What it means

executeGet builds the REST URL and converts it via URI.create(...).toURL(); if the URL string is not a syntactically valid URI, an IllegalArgumentException is caught and rethrown as this SeaTunnelException. It indicates the composed URL (base URL + path + node key + query params) is malformed.

Source

Thrown at seatunnel-connectors-v2/connector-firebase/src/main/java/org/apache/seatunnel/connectors/seatunnel/firebase/client/FirebaseHttpClient.java:182

                queryParts.add(encodeUriComponent(key) + "=" + encodeUriComponent(value));
            }
        }

        if (!queryParts.isEmpty()) {
            urlBuilder.append("?").append(String.join("&", queryParts));
        }
        return urlBuilder.toString();
    }

    /** Sends an HTTP GET request and handles status code verification. */
    private String executeGet(String urlStr) {
        HttpURLConnection connection = null;
        try {
            URL url;
            try {
                url = URI.create(urlStr).toURL();
            } catch (IllegalArgumentException e) {
                throw new SeaTunnelException(
                        "Invalid Firebase REST URI constructed. Check parameter formatting.");
            }
            connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("GET");
            connection.setConnectTimeout(timeoutMs);
            connection.setReadTimeout(timeoutMs);
            connection.setRequestProperty("Accept", "application/json");
            connection.setInstanceFollowRedirects(true);

            if (credentials != null) {
                String token = getAccessToken();
                connection.setRequestProperty("Authorization", "Bearer " + token);
            }

            int responseCode = connection.getResponseCode();
            if (responseCode >= 200 && responseCode < 300) {
                try (InputStream inputStream = connection.getInputStream();
                        BufferedReader reader =

View on GitHub (pinned to cf67b549a7)

Solutions

  1. URL-encode path segments and query parameter values (URLEncoder.encode) before they reach the client.
  2. Remove spaces and illegal characters from url/path/QUERY_PARAMS config values.
  3. Verify the base URL includes a valid scheme (https://) and host.
  4. Print the constructed urlStr (from the cause chain) to identify which component is malformed.

Example fix

// before
Map<String,String> params = Map.of("orderBy", "\"first name\""); // unencoded spaces/quotes
// after
String encoded = URLEncoder.encode("\"first name\"", StandardCharsets.UTF_8);
Map<String,String> params = Map.of("orderBy", encoded);
Defensive patterns

Strategy: validation

Validate before calling

String urlStr = baseUrl + path + nodeKey + queryParams;
URI.create(urlStr); // throws early if malformed
// encode dynamic segments:
String safeKey = URLEncoder.encode(nodeKey, StandardCharsets.UTF_8);

Prevention

When it happens

Trigger: Base URL or path containing illegal URI characters (spaces, unencoded symbols, curly braces); query params with unescaped values; a node key containing characters like '#' or '%' that break URI parsing.

Common situations: Users putting trailing spaces or full URLs (with scheme) into the path option; special characters in Firebase keys (e.g. email-like keys with dots are fine, but spaces/brackets are not); copy-pasted URLs with invisible characters.

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.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/077fc858e2a92cd4. Report an issue: GitHub.