{"record":{"id":"a8a8e5585408b919","repo":"apache/beam","slug":"unable-to-get-google-ads-response-after-retrying-d-times","errorCode":null,"errorMessage":"Unable to get Google Ads response after retrying %d times using query (%s)","messagePattern":"Unable to get Google Ads response after retrying (.+?) times using query \\((.+?)\\)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/google-ads/src/main/java/org/apache/beam/sdk/io/googleads/GoogleAdsV23.java","lineNumber":537,"sourceCode":"            if (retryableError.getDetails().getQuotaErrorDetails().hasRetryDelay()) {\n              nextBackoff =\n                  new BackOff() {\n                    @Override\n                    public void reset() {}\n\n                    @Override\n                    public long nextBackOffMillis() {\n                      return Durations.toMillis(\n                          retryableError.getDetails().getQuotaErrorDetails().getRetryDelay());\n                    }\n                  };\n            } else {\n              nextBackoff = backoff;\n            }\n          }\n        } while (BackOffUtils.next(sleeper, nextBackoff));\n\n        throw new IOException(\n            String.format(\n                \"Unable to get Google Ads response after retrying %d times using query (%s)\",\n                MAX_RETRIES, request.getQuery()),\n            lastException);\n      }\n\n      @Teardown\n      public void teardown() {\n        if (googleAdsServiceClient != null) {\n          googleAdsServiceClient.close();\n        }\n      }\n\n      private Optional<GoogleAdsError> findFirstRetryableError(GoogleAdsFailure e) {\n        return e.getErrorsList().stream()\n            .filter(\n                err ->\n                    // Unexpected internal error","sourceCodeStart":519,"sourceCodeEnd":555,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/google-ads/src/main/java/org/apache/beam/sdk/io/googleads/GoogleAdsV23.java#L519-L555","documentation":"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.","triggerScenarios":"A Google Ads query that fails on every retry within processElement - persistent API errors (quota exceeded, invalid query, auth expiry) exhausting MAX_RETRIES.","commonSituations":"Exceeded Google Ads API rate limits over an extended window; malformed GAQL query; expired credentials mid-run; Google Ads API outage.","solutions":["Inspect the cause (lastException) for the underlying Google Ads error code","Fix the GAQL query if it is a client error (4xx)","Reduce query rate / implement longer backoff to respect quotas","Refresh or fix credentials if auth errors are reported"],"exampleFix":"// before\nString query = \"SELECT invalid_field FROM campaign\";\n// after\nString query = \"SELECT campaign.id, campaign.name FROM campaign\"; // valid GAQL","handlingStrategy":"retry","validationCode":"// validate GAQL offline: check required SELECT/FROM present and fields exist for the resource","typeGuard":null,"tryCatchPattern":"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; }","preventionTips":["Respect Google Ads API quotas; batch queries and limit date ranges","Test GAQL queries in the Google Ads query validator","Monitor auth token expiry for long-running jobs"],"tags":["java","apache-beam","google-ads","retry","api"],"backgroundTag":"http-request-failed","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}