Keep on getting Resource_Exhausted error when I should not

778 views
Skip to first unread message

Sohail Zahid

unread,
Dec 4, 2022, 3:20:38 AM12/4/22
to Google Ads API and AdWords API Forum
Or maybe that is what I believe.

Regardless, I am doing a simple keyword idea search.through Google Ads API.  Now I am getting the error during debug:

com.google.ads.googleads.v12.errors.GoogleAdsException: errors {
  error_code {
    quota_error: RESOURCE_EXHAUSTED
  }
  message: "Too many requests. Retry in 4 seconds."
  details {
    quota_error_details {
      rate_scope: ACCOUNT
      rate_name: "Requests per service per method"
      retry_delay {
        seconds: 4
      }
    }
  }
}
request_id: "uirQ7fdTadKiA7rDg1aIeg"


****************************
The thing is I am not doing too many requests.  As attached in the screenshot below you can see that I have a total of 56 requests. And these are sent over the last 20 hours or so.

Please help. Very confusing to say the least.

Thank you.  :-)
google-ads-api-error1.jpg

Google Ads API Forum Advisor

unread,
Dec 5, 2022, 11:54:24 PM12/5/22
to sohai...@gmail.com, adwor...@googlegroups.com

Hi Sohail,


Thanks for reaching out to the Google Ads API team. I hope you are doing well today.
 

Kindly note that the RESOURCE_EXHAUSTED error generally occurs when you are sending too many requests in a short period of time. The server throws this error once it detects that your request has exceeded the system frequency limit. I would recommend setting up short delays between requests or combining more operations in fewer requests. Please refer to the Best practices guide to optimize the efficiency and performance.
 

Also, this may occur if you have already exceeded the daily limit of 15,000 API operations per day. You may refer to this documentation for the quota you need to consider daily when performing requests using the API. It says that the basic access level allows the developer token to execute up to 15,000 operational requests per day and 1,000 get operations per day only. However, we would request that you provide the complete request and response logs, with the request-id, generated for the RESOURCE_EXHAUSTED error in order to check further. You can enable logging, which you may do so by navigating to the Client libraries > Your client library (ex. Java) > Logging documentation, which you can access from this link

You can provide it via Reply privately to the author option. If this option is not available, then send it instead on this email address googleadsa...@google.com.
 

Regards,

Google Logo
Darwin
Google Ads API Team
 


ref:_00D1U1174p._5004Q2giL6I:ref

Sohail Zahid

unread,
Dec 6, 2022, 12:34:54 AM12/6/22
to Google Ads API Forum Advisor, adwor...@googlegroups.com

I am clear about the reasoning if I am doing too many requests in a short time.  This is why I sent the screeshot showing that I only did 56 or so requests in over 10 hours.

 

Also as noted in the error response, the message suggested that retry after 4 seconds.  I did try not only 4 seconds but after 10 minutes, 30 minutes and such without success and the same error message.

 

Is there something else I should look?

 

 

Thanks

Sohail

Peter Lanser

unread,
Dec 6, 2022, 7:25:20 PM12/6/22
to Google Ads API and AdWords API Forum
Hi,

we are experiencing the same issue (also using V12 of the Google Ads API).

Regards,
Peter Lanser

Google Ads API Forum Advisor

unread,
Dec 6, 2022, 9:35:19 PM12/6/22
to adwor...@googlegroups.com

Hi Peter and Sohail,

Thank you for your reply.

Kindly note that the API request and API operations are different from each other. A mutate request can have 10,000 operations per request. As said by Sohail, you are using a simple keyword idea search request. This request is the planning services in the Google Ads API. Due to cost and complexity, the Planning service methods listed below are subject to separate limits from other types of requests. Limited to 1 request per second per CID or developer token:


All requests to Keyword Planning services for both standard and basic access are rate limited. Fewer requests are allowed per minute when compared to other services. Our recommendation is to cache or store results as you will receive the same response over a long time span. For example, if you request a set of existing keywords, the response is not going to change over a period of hours or days. In the case of historical metrics, the statistics refresh monthly.

Moreover, I would recommend setting up short delays between requests or combine more operations in fewer requests. The server throws this error once it detects that your request has exceeded the system frequency limit. When you retry requests, you may continue using an exponential backoff policy by delaying 5-10 seconds. For example, if you first pause 5 seconds before the first retry, you could pause 10 seconds after the second and 20 seconds after the third retry. Exponential backoff helps ensure you are not calling the API too aggressively.

In addition, we suggest setting a reasonable upper bound for the total number of concurrent tasks that are going to make requests (across all processes and machines), and adjusting upward to optimize your throughput without exceeding the rate limit is recommended. Otherwise, you may possibly experience the exceeding rate limits that the client app is spawning an excessive number of parallel tasks since we don't limit the number of parallel requests a client app can have, this can easily exceed the Requests Per Second limit at the developer token level. However, Throttles can be implemented at the consumer side by limiting the number of concurrent consumers, or implement rate limiters or throttlers for either the producers or consumers.For more information, you may refer to this throttling QPS from the client side (check out Throttling and rate limiters). 

Let us know if you need further clarification.

Regards,

Google Logo
Yasar
Google Ads API Team
 


ref:_00D1U1174p._5004Q2giL6I:ref

AdWordsApiUser

unread,
Dec 6, 2022, 10:51:08 PM12/6/22
to Google Ads API and AdWords API Forum
We are seeing increased frequency of the same error as well. We have standard access, and have not encountered this error before. It seems to be something happening from the API. I'd request the team to check if everything is OK with the API.

ro...@searchkings.ca

unread,
Dec 6, 2022, 11:20:09 PM12/6/22
to Google Ads API and AdWords API Forum
Just chiming in with similar feedback. We're receiving rate limit errors this morning that we've not seen at any point in the past. We have exponential retries implemented so the jobs eventually succeed, but came here to see others experiencing the same thing.

We recently updated to v12 in case that is of relevance.

Google Ads API Forum Advisor

unread,
Dec 7, 2022, 3:26:41 PM12/7/22
to ro...@searchkings.ca, adwor...@googlegroups.com

Hi everyone,

Thanks for commenting in this forum thread.

I understand the inconvenience you are encountering due to this issue. However, for me to request my rest of the team to look into this matter, could you provide us with the complete request and response logs with request ID generated for the RESOURCE_EXHAUSED error? These logs should help our team better investigate this matter.

Kindly send your complete logs via reply privately to author option.

Regards,

sealytic...@gmail.com

unread,
Dec 8, 2022, 6:31:42 PM12/8/22
to Google Ads API and AdWords API Forum
Hello,

We have standard access, despite that from yesterday we are getting this error regularly.
I think same with the other people, it looks there is a problem on API.

Is there any limitation for Standard Access. I checked your sharing but I cannot see any there.

Google Ads API Forum Advisor

unread,
Dec 9, 2022, 3:58:30 AM12/9/22
to sealytic...@gmail.com, adwor...@googlegroups.com
Hi,

Having standard access allows for unlimited operations per day. However, you would still be subject to the rate limits or QPS limit discussed here.

Encountering the RESOURCE_EXHAUSTED error when having standard access indicates that you could be performing too many requests within a short period of time, or that the API's servers are imposing a limit based on all users traffic :
  • "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."
That said, we recommend mitigating the number of requests being made within a short period of time, checking for any parallel processes that also uses your account and developer token, as well as performing retries and the methods mentioned in the guide, to avoid or manage this error. 

Best regards,

Google Logo
Peter Laurence
Google Ads API Team
 


ref:_00D1U1174p._5004Q2giL6I:ref

Parth Vallabhdas Makadiya

unread,
Jul 11, 2024, 1:09:00 AMJul 11
to Google Ads API and AdWords API Forum
Hey,
I am having similar issues on the same topic. We are using `KeywordPlanService.GenerateHistoricalMetrics`. We have standard access developer token. (So only 1QPS limit applies here.)

I am getting `RESOURCE_EXHAUSTED` (yesterday everything was working fine.)
I am using rate limitting and I am calling the api every 10 seconds .

Time of Calls (with <=9000 keywords in each req)
18:40:13 success ----> next : 18:40:32 success -----> next 18:40:52 fail

Error Details:
```
Headers: Metadata(content-type=application/grpc,request-id=qwUXyYeO1kGLjvVZYRnN4g,date=Wed, 10 Jul 2024 16:40:52 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: "qwUXyYeO1kGLjvVZYRnN4g"
```

Please let me know what is wrong ?
Thank you.

Parth Makadiya

Google Ads API Forum Advisor

unread,
Jul 11, 2024, 5:26:42 AMJul 11
to parth.vallab...@zalando.de, adwor...@googlegroups.com
Hi,

Kindly note that encountering the RESOURCE_EXHAUSTED error when having standard access indicates that you could be performing too many requests within a short period of time, or that the API's servers are imposing a limit based on all users traffic :
  • 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.
That said, we recommend mitigating the number of requests being made within a short period of time, checking for any parallel processes that also uses your account and developer token, as well as performing retries and the methods mentioned in the guide, to avoid or manage this error. 
 
This message is in relation to case "ref:!00D1U01174p.!5004Q02giL6I:ref" (ADR-00159325)

Thanks,

 
Google Logo Google Ads API Team

Register for the upcoming workshop: Performance Max and the Google Ads API!
 


Reply all
Reply to author
Forward
0 new messages