quota_error: RESOURCE_EXHAUSTED without QuotaErrorDetails

124 views
Skip to first unread message

Markus Heiden

unread,
Apr 28, 2023, 7:44:28 PM4/28/23
to Google Ads API and AdWords API Forum
Hi,

I am using KeywordPlanIdeaService.generateKeywordIdeas() and sometimes getting quota errors though I obey the 1 QPS rate limit. Furthermore the quota error message says that I need to wait for 30 seconds. But there are no corresponding QuotaErrorDetails (hasDetails() says false). So I am not able to do that programmatically. 

Is that normal behavior? 
How to handle missing QuotaErrorDetails? 
Have I to wait always for 30 seconds in such cases then?

Thanks,
Markus

Google Ads API Forum Advisor

unread,
May 2, 2023, 5:05:40 AM5/2/23
to markus...@adsoul.com, adwor...@googlegroups.com

Hi Markus,

Thank you for reaching out to us.

Kindly note that due to cost and complexity, the Planning service methods listed below are subject to separate limits from other types of requests. To see the limitations of this in more detailed, you may check this documentation.

Additionally, 1 QPS is calculated as 60 requests per 60 seconds.

On the other hand, If you are still encountering error after considering the information below, then you may provide us with the complete API logs (request and response with request-id) generated on your end including the error so that our team can further check this and provide you with more appropriate recommendations.

Note that logs can be requested or provided to the developer handling the Google Ads API transactions when logging of the API requests has been enabled. You may check here and click your client library for the specific guideline to enable it.

For REST interface requests, you can enable logging via the curl command by using the -i flag. This will cause the tool to include the HTTP response headers in the output. 

You may then send the requested information via the Reply privately to author option. If this option is not available, you may send the details directly to our googleadsa...@google.com alias instead.

Best regards,

Google Logo Google Ads API Team


ref:_00D1U1174p._5004Q2l8R9Q:ref

Markus Heiden

unread,
May 3, 2023, 9:14:37 AM5/3/23
to Google Ads API and AdWords API Forum
Hi,

the main (unanswered) question was:
Why do I get a rate limit error _without QuotaErrorDetails_?

IMO that makes automation hard, because it is required by the docs that I have to wait the provided amount of time. I wouldn't like to resort to parsing error messages to extract the retry delay.

The linked documentation for the planning service mainly contains details for the KeywordPlanService while I have problems with the KeywordPlan_Idea_Service.

Request
-------
MethodName: google.ads.googleads.v13.services.KeywordPlanIdeaService/GenerateKeywordIdeas
Endpoint: googleads.googleapis.com:443
Headers: {developer-token=REDACTED, login-customer-id=REDACTED, x-goog-api-client=gl-java/20.0.1 gccl/25.0.0 gapic/25.0.0 gax/2.25.0 grpc/1.54.0 pb/3.21.12}
Body: customer_id: "REDACTED"
keyword_and_url_seed {
  url: "REDACTED"
  keywords: "REDACTED"
  keywords: "REDACTED"
  keywords: "REDACTED"
  keywords: "REDACTED"
  keywords: "REDACTED"
  keywords: "REDACTED"
  keywords: "REDACTED"
  keywords: "REDACTED"
  keywords: "REDACTED"
  keywords: "REDACTED"
  keywords: "REDACTED"
  keywords: "REDACTED"
  keywords: "REDACTED"
  keywords: "REDACTED"
  keywords: "REDACTED"
  keywords: "REDACTED"
  keywords: "REDACTED"
  keywords: "REDACTED"
  keywords: "REDACTED"
  keywords: "REDACTED"
}
keyword_plan_network: GOOGLE_SEARCH
language: "languageConstants/1001"
historical_metrics_options {
  year_month_range {
    start {
      year: 2023
      month: MARCH
    }
    end {
      year: 2023
      month: MARCH
    }
  }
  include_average_cpc: true
}


Response
--------
Headers: Metadata(content-type=application/grpc,request-id=SmIXAMeqCnBLAqh1aSFFjw,date=Wed, 03 May 2023 13:06:09 GMT,alt-svc=h3=":443"; ma=2592000,h3-29=":443"; ma=2592000)
Body: null
Failure message: errors {
  error_code {
    quota_error: RESOURCE_EXHAUSTED
  }
  message: "Too many requests. Retry in 30 seconds."
}
request_id: "SmIXAMeqCnBLAqh1aSFFjw"

Status: Status{code=RESOURCE_EXHAUSTED, description=Resource has been exhausted (e.g. check quota)., cause=null}.

Best regards,
Markus

Google Ads API Forum Advisor

unread,
May 4, 2023, 8:15:52 PM5/4/23
to markus...@adsoul.com, adwor...@googlegroups.com

Hi Markus,

Thank you for getting back to us.

Upon checking your logs, I can see that you are getting a RESOURCE_EXHAUSTED quota error. As per this documentation (https://developers.google.com/google-ads/api/docs/best-practices/quotas#daily_api_operation_limits), daily API usage limits are based on the number of API operations made per developer token. API operations are the total sum of get requests and mutate operations. The limits for daily API operations depend on the access level of the developer token. The Access Levels and Permissible Use guide outlines the specific API operation limits for each access level. Requests that violate these limits are rejected with the error: RESOURCE_EXHAUSTED.

Additionally, the API Limits and Quotas (https://developers.google.com/google-ads/api/docs/best-practices/quotas) is not just limited to Planning Service requests but other request types also such as Operations with Basic Access.

Reference Links:

Regards,

Markus Heiden

unread,
May 5, 2023, 9:50:11 AM5/5/23
to Google Ads API and AdWords API Forum
Hi,

thanks for pointing out that I hit the daily API operations limit. I didn't expect that :-)
It would have been nice if there had been a reference to the daily limit in the error. 
Or does RESOURCE_EXHAUSTED always just relates to the daily limit? If so, I misunderstood the description "too many request" in the referenced docs, because that could be interpreted as hitting any other quota limit too.

My bigger problem: I cannot handle such errors automatically by code, because the QuotaErrorDetails are missing. Why?

Best regards,
Markus

Google Ads API Forum Advisor

unread,
May 5, 2023, 1:48:16 PM5/5/23
to markus...@adsoul.com, adwor...@googlegroups.com

Hi Markus,

Thank you for getting back to us.

Note the Google Ads API buckets requests for rate limiting by queries per second (QPS) per client customer ID (CID) and developer token, meaning that metering is enforced independently on both CIDs and developer tokens. The Google Ads API uses a Token Bucket algorithm to meter requests and determine an appropriate QPS limit, so the exact limit will vary depending on the overall server load at any given time.

Since this is an operation, note that the limit of operations per day is 15,000 API operations. If you exceed, you will get a RESOURCE_EXHAUSTED error. Note that this only applies for a Developer Token with Basic Access.

Please note that, for this API that number can change over time. Either the server load or the expense of the request can affect how many requests can be sent. In your particular case, I believe that the resource exhausted is happening at the account level. There is no quota dashboard for that. Our system takes into account the requests that are being made from ALL interfaces Google Ads UI, Google Ads Editor, Google Ads scripts, Google Ads API (multiple developers at the same time on the same account), and other automated processes. If one of those interfaces is already making expensive requests, our system will push back with this error so that no one gets completely locked out. If we didn't do that, then an advertiser would be unable to log into the Google Ads UI because the account would be overwhelmed.

Let me know if this clarifies your concern.

Links included in this email:

Message has been deleted

Markus Heiden

unread,
May 22, 2023, 11:48:46 AM5/22/23
to Google Ads API and AdWords API Forum
Hi,

sorry for getting back to you again, but my main question is still unanswered:
Why are there no QuotaErrorDetails in this case? 

That would provide guidance about how long to wait. I cannot determine that upfront in a distributed environment as you already pointed out.

In other words: Feature request: I would like to get QuotaErrorDetails for all QuotaErrors.

Thanks,
Markus

Google Ads API Forum Advisor

unread,
May 24, 2023, 11:09:23 AM5/24/23
to markus...@adsoul.com, adwor...@googlegroups.com
Hi Markus,

Thank you for getting back to us. I hope that you are doing well today.

I understand that what you want to see here is the quota_error_details. With this, I raised a feature request so that it becomes available in the future. However, please note that this will be a subject for review and what we can do is to advise you to keep an eye on our blog post and release notes for the updates and releases.

For now, you may refer to the API limits and Quotas documentation here https://developers.google.com/google-ads/api/docs/best-practices/quotas.

Reference links:  
This message is in relation to case "ref:_00D1U1174p._5004Q2l8R9Q:ref"

Thanks,

 
Google Logo Google Ads API Team


Reply all
Reply to author
Forward
0 new messages