apache/beam · error · IOException

Unable to get Google Ads response after retrying

Error message

Unable to get Google Ads response after retrying %d times using query (%s)

What it means

GoogleAdsV23.processElement retries the GoogleAdsService.search call up to MAX_RETRIES with backoff; if all attempts fail it throws IOException 'Unable to get Google Ads response after retrying N times using query (...)' with the last exception as cause.

Solutions

  1. Inspect the cause (lastException) for the underlying Google Ads error code
  2. Fix the GAQL query if it is a client error (4xx)
  3. Reduce query rate / implement longer backoff to respect quotas
  4. Refresh or fix credentials if auth errors are reported

Example fix

// before
String query = "SELECT invalid_field FROM campaign";
// after
String query = "SELECT campaign.id, campaign.name FROM campaign"; // valid GAQL
Defensive patterns

Strategy: retry

Validate before calling

// validate GAQL offline: check required SELECT/FROM present and fields exist for the resource

Try / catch

try { read.expand(p); } catch (IOException e) { if (e.getMessage().startsWith("Unable to get Google Ads response after retrying")) { inspectCauseAndBackoff(e.getCause()); } else throw e; }

Prevention

When it happens

Trigger: A Google Ads query that fails on every retry within processElement - persistent API errors (quota exceeded, invalid query, auth expiry) exhausting MAX_RETRIES.

Common situations: Exceeded Google Ads API rate limits over an extended window; malformed GAQL query; expired credentials mid-run; Google Ads API outage.

Understand the failure class

Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/a8a8e5585408b919. Report an issue: GitHub.

Appendix: source

Thrown at sdks/java/io/google-ads/src/main/java/org/apache/beam/sdk/io/googleads/GoogleAdsV23.java:537

            if (retryableError.getDetails().getQuotaErrorDetails().hasRetryDelay()) {
              nextBackoff =
                  new BackOff() {
                    @Override
                    public void reset() {}

                    @Override
                    public long nextBackOffMillis() {
                      return Durations.toMillis(
                          retryableError.getDetails().getQuotaErrorDetails().getRetryDelay());
                    }
                  };
            } else {
              nextBackoff = backoff;
            }
          }
        } while (BackOffUtils.next(sleeper, nextBackoff));

        throw new IOException(
            String.format(
                "Unable to get Google Ads response after retrying %d times using query (%s)",
                MAX_RETRIES, request.getQuery()),
            lastException);
      }

      @Teardown
      public void teardown() {
        if (googleAdsServiceClient != null) {
          googleAdsServiceClient.close();
        }
      }

      private Optional<GoogleAdsError> findFirstRetryableError(GoogleAdsFailure e) {
        return e.getErrorsList().stream()
            .filter(
                err ->
                    // Unexpected internal error

View on GitHub (pinned to 12126d8942)