Guides
Errors
The google.rpc.Status envelope, the GoogleAdsFailure with errorCode, message, trigger and location, the HTTP statuses and how to handle each one.
All of Google's JSON APIs return errors in the REST format of google.rpc.Status, inside error. In the Google Ads API, details carries a GoogleAdsFailure with one item per error. OAuth (/token, /revoke, /v1/userinfo) uses the OAuth format: {"error": "invalid_grant", "error_description": "…"}.
The envelope
{
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"status": "INVALID_ARGUMENT",
"details": [{
"@type": "type.googleapis.com/google.ads.googleads.v26.errors.GoogleAdsFailure",
"errors": [{
"errorCode": { "campaignError": "DUPLICATE_CAMPAIGN_NAME" },
"message": "Trying to modify the name of an active or paused campaign, where the name is already assigned to another active or paused campaign.",
"trigger": { "stringValue": "Campanha X" },
"location": { "fieldPathElements": [
{ "fieldName": "mutate_operations", "index": 1 },
{ "fieldName": "campaign_operation" },
{ "fieldName": "create" },
{ "fieldName": "name" }
] }
}],
"requestId": "Xy3…"
}]
}
}errorCodeis an object with a single key, the family, and the enum value. To check a code, look at the values:Object.values(e.errorCode)[0].messageis Google's official message for the code.triggeris the value that caused the error:stringValue,int64Value,booleanValueordoubleValue.location.fieldPathElementsuses the proto names in snake_case (mutate_operations,campaign_operation,operationsin per-service mutates), withindexon lists.- The error's
detailsappears for some codes:quotaErrorDetails,policyFindingDetails,resourceCountDetails,budgetPerDayMinimumErrorDetails. - The
@typecarries the path's version:…v25…on a call to/v25. - A request with several errors returns all of them, in operation order.
- The response's
request-idheader equalsrequestId.
HTTP status
| Family or case | HTTP | status |
|---|---|---|
| Request, field, query and most resource errors | 400 | INVALID_ARGUMENT |
headerError: INVALID_LOGIN_CUSTOMER_ID | 400 | INVALID_ARGUMENT |
authenticationError, missing or invalid token | 401 | UNAUTHENTICATED |
authorizationError, scope, API disabled | 403 | PERMISSION_DENIED |
| Nonexistent method or version | 404 | NOT_FOUND |
databaseError: CONCURRENT_MODIFICATION | 409 | ABORTED |
quotaError | 429 | RESOURCE_EXHAUSTED |
internalError: INTERNAL_ERROR | 500 | INTERNAL |
| Route outside Mimicr's core | 501 | UNIMPLEMENTED |
internalError: TRANSIENT_ERROR | 503 | UNAVAILABLE |
Malformed JSON or JSON with an unknown field responds 400 with Google's parser message ("Invalid JSON payload received. Unknown name \"x\" at '…': Cannot find field.") and google.rpc.BadRequest. In Mimicr, fields are checked against the v26 catalog.
Errors you will see
| Code | Cause |
|---|---|
authorizationError: USER_PERMISSION_DENIED | Unknown account, no access, or client account without login-customer-id |
authorizationError: CUSTOMER_NOT_ENABLED | Account canceled, closed or with incomplete setup |
requestError: INVALID_CUSTOMER_ID | Id with hyphens or letters |
fieldMaskError: FIELD_MASK_MISSING | Update without updateMask |
mutateError: RESOURCE_NOT_FOUND | Nonexistent or removed resource, or temporary id referenced before its create |
newResourceCreationError: TEMP_ID_RESOURCE_HAD_ERRORS | Depends on a temporary id that failed |
queryError: * | Invalid GAQL (see GAQL) |
quotaError: RESOURCE_EXHAUSTED | Daily quota (see Quotas) |
databaseError: CONCURRENT_MODIFICATION | Another mutate on the same campaign |
How to handle each one
400 INVALID_ARGUMENT: fix the request; showerrors[].messageto whoever entered the data.401: renew the access token with the refresh token; if the refresh givesinvalid_grant, ask for authorization again.403: checklogin-customer-id, the account status and the scopes.SERVICE_DISABLEDcarriesmetadata.activationUrl.409 CONCURRENT_MODIFICATION,500and503: retry with increasing backoff (for example 2, 4 and 6 seconds).429: wait for theretryDelayinquotaErrorDetails.
Data Manager
The Data Manager uses the same envelope without GoogleAdsFailure. details carries google.rpc.ErrorInfo (domain: datamanager.googleapis.com), google.rpc.RequestInfo and, on validation errors, google.rpc.BadRequest with fieldViolations[{field, description, reason}]. See Conversions via Data Manager.