apache/seatunnel · error · SeaTunnelException

Firebase HTTP request failed with status code %d. Response b

Error message

Firebase HTTP request failed with status code %d. Response body: %s

What it means

executeGet throws this SeaTunnelException when the Firebase REST endpoint returns a non-success HTTP status code. The message includes the status code and the error response body (or 'N/A' if empty). It wraps HTTP-level failures such as 401/403 (auth), 404 (bad path), and 5xx (server errors).

Source

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

            }

            int responseCode = connection.getResponseCode();
            if (responseCode >= 200 && responseCode < 300) {
                try (InputStream inputStream = connection.getInputStream();
                        BufferedReader reader =
                                new BufferedReader(
                                        new InputStreamReader(
                                                inputStream, StandardCharsets.UTF_8))) {
                    StringBuilder responseBuilder = new StringBuilder();
                    String line;
                    while ((line = reader.readLine()) != null) {
                        responseBuilder.append(line);
                    }
                    return responseBuilder.toString();
                }
            } else {
                String rawErrorBody = readErrorStream(connection);
                throw new SeaTunnelException(
                        String.format(
                                "Firebase HTTP request failed with status code %d. Response body: %s",
                                responseCode, rawErrorBody.isEmpty() ? "N/A" : rawErrorBody));
            }
        } catch (IOException e) {
            throw new SeaTunnelException("Failed to execute HTTP request to Firebase endpoint", e);
        } finally {
            if (connection != null) {
                connection.disconnect();
            }
        }
    }

    private String encodeUriComponent(String value) {
        try {
            return URLEncoder.encode(value, StandardCharsets.UTF_8.name())
                    .replaceAll("\\+", "%20"); // Handle space encoding for URIs
        } catch (UnsupportedEncodingException e) {

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Read the status code and body in the message: fix auth for 401/403, path for 404, back off for 429, retry for 5xx.
  2. Verify service account credentials have read access to the Realtime Database.
  3. Confirm the URL/path points to an existing node in the correct database instance.
  4. Add retry logic with backoff for transient 5xx/429 responses.

Example fix

null
Defensive patterns

Strategy: retry

Validate before calling

// preflight: verify access
HttpURLConnection c = (HttpURLConnection) URI.create(url + ".json").toURL().openConnection();
int code = c.getResponseCode();
if (code == 401 || code == 403) throw new IllegalStateException("check Firebase auth/permissions");

Try / catch

catch (SeaTunnelException e) { if (e.getMessage().contains("status code 5") || e.getMessage().contains("status code 429")) { backoffAndRetry(); } else { throw e; } }

Prevention

When it happens

Trigger: Firebase returns 401/403 due to missing or expired auth token; 404 because the path/node does not exist; 429 rate limiting; 5xx from Firebase or an intermediary proxy.

Common situations: Service account without Realtime Database permissions; wrong database URL region; deleted node; exceeding Firebase quota; corporate proxy rejecting the request.

Understand the failure class

Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.

Related errors


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