Stay organized with collections
Save and categorize content based on your preferences.
This page lists common errors and provides tips on preventing and handling them.
For a complete list of errors, review the error
references. For further support, visit our
forum.
google.auth.exceptions.RefreshError
invalid_grant
Summary
Token has been expired or revoked.
Common causes
A Google Cloud Platform project with an OAuth consent screen configured for an external user type and a publishing status of Testing is issued a refresh token expiring in 7 days.
How to handle
Your Google project's publishing status is Testing so the refresh token expires every 7 days and receives an invalid_grant error. Go to the Google API Console and navigate to the OAuth consent screen. Then change the publishing status to In production following these instructions to avoid the refresh token expiring in 7 days.
This operator cannot be used with a subclass of Ad.
Common causes
Trying to modify attributes other than the status of the ad.
How to handle
N/A
Prevention tips
Once an ad is created, it cannot be modified. If you would like to modify the ad, you must make a new ad and then remove the old one. The status of the ad is, however, modifiable using MutateAdGroupAds.
INVALID_INPUT
Summary
One of the fields in an ad contains invalid characters.
Common causes
Using special characters in URLs.
How to handle
N/A
Prevention tips
Validate URLs in your app before making the API request.
LINE_TOO_WIDE
Summary
One of the fields in an ad was longer than the maximum allowed length. See About text ads.
Common causes
Having too long of a line of text.
How to handle
N/A
Prevention tips
Validate the length of the line before making the API request.
123-456-7890 should be 1234567890. See Get started for details.
CLIENT_CUSTOMER_ID_IS_REQUIRED
Summary
Client customer ID was not specified in the HTTP header.
Common causes
Not specifying a client customer ID in the HTTP header.
How to handle
N/A
Prevention tips
Client customer ID is required for all calls, so make sure you've specified one in the HTTP header. Consider using our client libraries as they handle this for you.
CUSTOMER_NOT_FOUND
Summary
No account found for the customer ID provided in the header.
Common causes
Trying to access an account that was just created before the account is established in the backend.
How to handle
Wait an initial five minutes, then retry every 30 seconds.
Prevention tips
Wait a few minutes after the account is created before issuing requests against it.
GOOGLE_ACCOUNT_COOKIE_INVALID
Summary
The access token in the request header is either invalid or has expired.
Common causes
The access token has been invalidated.
How to handle
Request a new token. If you're using one of our client libraries, consult its documentation on how to refresh the token.
Prevention tips
Store and reuse access tokens until they expire.
NOT_ADS_USER
Summary
The Google account used to generate the access token is not associated with any Google Ads account.
Common causes
The login information provided corresponds to a Google account that does not have Google Ads enabled.
How to handle
Make sure to sign in with a valid Google Ads account (typically your manager account) for the OAuth flow. You can also invite the Google account to access an existing Google Ads account by signing in to your manager account, selecting the customer or manager account in question, navigating to Tools and Settings > Access and security, then adding the Google account email address.
Prevention tips
N/A
OAUTH_TOKEN_INVALID
Summary
OAuth access token in the header is not valid.
Common causes
Your access token passed with the HTTP header was not correct.
How to handle
N/A
Prevention tips
Make sure you've passed the correct access token associated with your account. It's sometimes confused with refresh tokens and authorization codes. If you would like to get a credential that can access all client accounts under a manager account, make sure you get the refresh token for the manager account. For more details, see our guide on access token and refresh token and OAuth2.
The customer account cannot be accessed because it is not in an enabled state.
Common causes
This occurs when the customer account hadn't finished signup or had been deactivated.
How to handle
Sign in to the Google Ads UI and ensure that you've completed the signup process for this account. For deactivated accounts, see Reactivate a cancelled Google Ads account.
Prevention tips
You can proactively check if a customer account is deactivated by checking for a status of CANCELLED.
DEVELOPER_TOKEN_NOT_APPROVED
Summary
The developer token is only approved for use with test accounts and attempted to access a non-test account.
Common causes
A test developer token was used to access a non-test account.
The developer token is not allowed with the project sent in the request.
Common causes
Each Google API Console project can be associated with the developer token from only one manager account. Once you make a Google Ads API request, the developer token is permanently paired to the Google API Console project. If you don't use a new Google API Console project, you'll get a DEVELOPER_TOKEN_PROHIBITED error when making a request.
How to handle
N/A
Prevention tips
If switching to a developer token under a new manager account, you'll need to create a new Google API Console project for Google Ads API requests that use the new manager's token.
USER_PERMISSION_DENIED
Summary
The authorized customer does not have access to the operating customer.
Common causes
Authenticating as a user with access to a manager account but not specifying login-customer-id in the request.
How to handle
N/A
Prevention tips
Specify the login-customer-id as the manager account ID without hyphens (-). Client libraries have built in support for this.
The request timed out and could not be completed quickly enough to return a response.
Common causes
A search request was made that generated too large of a response, or a mutate request was too large to process.
How to handle
Wait for about 30 seconds, then retry the request. If the error persists try breaking the request into multiple, smaller requests that can be completed more quickly.
Something unexpected happened while processing the request.
Common causes
The API isn't functioning correctly due to a bug.
How to handle
Retry any requests that failed with this error, using an exponential backoff schedule for the retries.
Prevention tips
N/A
TRANSIENT_ERROR
Summary
A transient internal error has occurred, and a retry should be performed.
Common causes
This error occurs when the API internally encounters a temporary issue.
How to handle
Retry any requests that failed with this error, using an exponential backoff schedule for the retries.
Prevention tips
N/A
InvalidGrantError
invalid_grant (malformed auth code)
Summary
The authorization code exchanged for OAuth tokens was malformed.
Common causes
This happens when attempting to generate a refresh token for a user that has already been granted access to the requesting application. For instance, this can happen when running the Generate User credentials example more than once for the same OAuth client credentials and authorizing user.
How to handle
In order to regenerate a refresh token for a given combination of authorizing user and OAuth client credentials, revoke an existing refresh token. Note that revoking a token renders it unusable for Google Ads API access and invalidates any access tokens that the refresh token was used to generate.
Prevention tips
Make sure to store your refresh token in a secure location to avoid the need for regeneration.
The request referred to a resource that could not be found.
Common causes
The request attempted to mutate or otherwise reference a resource that does not exist or has been removed. Or, the given resource name for the resource is malformed.
How to handle
Use a search request to retrieve the resource name for an existing resource before submitting a mutate request. Review our client library guides, which include documentation on how to construct valid resource names in every supported language
Prevention tips
Don't create resource names manually. Use one of the helper methods offered by our client libraries.
The request is attempting to create a resource that would cause the total number of those resources to exceed a specified limit.
Common causes
There are multiple limits on the number of resources that can exist in certain contexts.
How to handle
Identify the limit that's being encountered by reviewing System limits. Either reuse an existing resource, or remove resources to create space for new ones.
Prevention tips
Use search queries to monitor the number of resources that have limitations.