Error message only contains "Request contains an invalid argument" without details when using grpc client

2,038 views
Skip to first unread message

Kenny Chen

unread,
Aug 12, 2022, 1:06:32 AM8/12/22
to Google Ads API and AdWords API Forum
Hello,
When I am using grpc client in golang to remove a campaign, the only error message I can get is "rpc error: code = InvalidArgument desc = Request contains an invalid argument.".
But when I am using rest api to remove a campaign, I can get more information like "Resource was not found", "This operation is not allowed because the resource is removed." or "Resource name 'customer/1234567890/campaigns/12345678901' is malformed: expected 'customers/{customer_id}/campaigns/{campaign_id}'." ...etc

I want to know how can I get a completed error message without directly using rest.
Do other languages using offical google api client library have the same issue? I know there isn't a offical google api client library for golang.

belows are the full outputs of 1 grpc error and 3 rest responses (I replaced campaign id, customer id and request id with "xxxxx").

grpc:
panic: rpc error: code = InvalidArgument desc = Request contains an invalid argument.

rest 1:
{
  "error": {
    "code": 400,
    "message": "Request contains an invalid argument.",
    "status": "INVALID_ARGUMENT",
    "details": [
      {
        "errors": [
          {
            "errorCode": {
              "mutateError": "RESOURCE_NOT_FOUND"
            },
            "message": "Resource was not found.",
              "stringValue": "CampaignId: xxxxx"
            },
            "location": {
              "fieldPathElements": [
                {
                  "fieldName": "operations",
                  "index": 0
                },
                {
                  "fieldName": "remove"
                }
              ]
            }
          }
        ],
        "requestId": "xxxxx"
      }
}

rest2:
{
  "error": {
    "code": 400,
    "message": "Request contains an invalid argument.",
    "details": [
      {
        "@type": "type.googleapis.com/google.ads.googleads.v11.errors.GoogleAdsFailure",
        "errors": [
          {
            "errorCode": {
              "requestError": "RESOURCE_NAME_MALFORMED"
            },
            "message": "Resource name 'customer/xxxxx/campaigns/xxxxx' is malformed: expected 'customers/{customer_id}/campaigns/{campaign_id}'.",
            "location": {
              "fieldPathElements": [
                {
                  "fieldName": "operations",
                  "index": 0
                },
                {
                  "fieldName": "remove"
                }
              ]
            }
          }
        ],
        "requestId": "xxxxx"
      }
    ]
  }
}

rest 3:
{
  "error": {
    "code": 400,
    "message": "Request contains an invalid argument.",
    "details": [
      {
        "@type": "type.googleapis.com/google.ads.googleads.v11.errors.GoogleAdsFailure",
        "errors": [
          {
            "errorCode": {
              "operationAccessDeniedError": "OPERATION_NOT_PERMITTED_FOR_REMOVED_RESOURCE"
            },
            "message": "This operation is not allowed because the resource is removed.",
            "trigger": {
              "stringValue": "Campaign"
            },
            "location": {
              "fieldPathElements": [
                {
                  "fieldName": "operations",
                  "index": 0
                }
              ]
            }
          }
        ],
        "requestId": "xxxxx"
      }
    ]
  }
}

Google Ads API Forum Advisor

unread,
Aug 12, 2022, 2:48:57 AM8/12/22
to kenn...@phygitalker.com, adwor...@googlegroups.com
Hi Kenny,

Thank you for raising your concern to my team. Allow me to provide support.

To answer this question first "Do other languages using offical google api client library have the same issue? I know there isn't a offical google api client library for golang.", the official / supported client libraries don't have the said issue as it can provide detailed information of the error especially when logging is enabled when one of the instruction is being followed:
Moving forward to your issue on the first and third REST API, please provide the complete request and response logs with request ID and request header generated on your end where we can see the errors. We will be needing this information to investigate and address it. You can provide it via Reply privately to author option. If this option is not available, then send it instead on this email address googleadsa...@google.com.

As for the second REST API, you can try this format customers/{customer_id}/campaigns/{campaign_id} as the error message suggested.

Regards,
Google Logo
Ernie John
Google Ads API Team
 


ref:_00D1U1174p._5004Q2dJyXu:ref
Reply all
Reply to author
Forward
0 new messages