removing labels - internal error

114 views
Skip to first unread message

Shawn Naquin

unread,
Apr 25, 2022, 5:18:37 PM4/25/22
to Google Ads API and AdWords API Forum
Hi, 

I have an account that informed: 
```
errors":[{"errorCode":{"resourceCountLimitExceededError":"RESOURCE_LIMIT"},"message":"This request would exceed a limit on the number of allowed resources. The details of which type of limit was exceeded will eventually be returned in ErrorDetails.","trigger":{"stringValue":"LIMITED_LABELS_PER_TYPE_PER_CUSTOMER"},
```
so I wrote a script to delete some labels, however, when I run the script I get another error:
```
Failure: {"errors":[{"errorCode":{"internalError":"INTERNAL_ERROR"},"message":"An internal error has occurred."}]
```

The request looks something like:
```
{"customerId":"REDACTED","operations":[{"remove":"customers/REDACTED/labels/REDACTED"}, ...]
```

the php code generating this output is here, and it is well-formed, and works otherwise:
```
        $operations = [];

        $updateLabel = function(
            String $resourceName
        ) use(&$operations) {


            $labelOperation = new LabelOperation();
            $labelOperation->setRemove($resourceName);
            $operations[] = $labelOperation;

        };

        $query =
            "SELECT
                label.id,
                label.resource_name,
                label.status,
                label.name,
                ad_group.status
            FROM ad_group_label
            WHERE label.status != 'REMOVED'
            AND ad_group.status NOT IN ('REMOVED', 'PAUSED')";

        $labelExistsResponse = $this->search($query);

        $active = [];

        foreach (
            $labelExistsResponse->iterateAllElements()
            as $googleAdsRow
        ) {

            $label = $googleAdsRow->getLabel();
            $labelResourceName = $label->getResourceName();
            $labelName = $label->getName();
            $active[$labelResourceName] = $labelName;

        }

        $active = array_keys($active);

        $query =
            "SELECT
                label.id,
                label.resource_name,
                label.status,
                label.name,
                ad_group.status
            FROM ad_group_label
            WHERE label.status != 'REMOVED'";


        $labelExistsResponse = $this->search($query);

        $remove = [];

        foreach (
            $labelExistsResponse->iterateAllElements()
            as $googleAdsRow
        ) {

            $label = $googleAdsRow->getLabel();
            $labelResourceName = $label->getResourceName();
            $labelName = $label->getName();

            if (
                !in_array($labelResourceName, $active)
            ) {
                $remove[$labelResourceName] = $labelName;
            }

        }

        foreach(
            $remove as $resourceName => $name
        ) {
            $updateLabel(
                $resourceName
            );
        }

        if (
            $operations
        ) {

            // Issues a mutate request to update the ad group.
            $response =
                $this->googleAdsClient
                    ->getLabelServiceClient()
                    ->mutateLabels(
                        $this->clientId,
                        $operations
                    );

            $updatedLabels = $response->getResults()->count();

        }
```

Can you inform me what the internal error is? Thanks in advance! I can send you the error log if needed.

Shawn

Google Ads API Forum Advisor

unread,
Apr 26, 2022, 4:16:27 PM4/26/22
to sna...@themorangroup.net, adwor...@googlegroups.com

Hello Shawn,

Thanks for reaching out to the Google Ads API forum. I have seen you encountered two separate errors generated on your end.
For us to investigate, could you please provide us with both complete logs within the format of the request and response logs with request-id and login-customer-id, so our team can better check the root cause of the error. Please let me know if you have any questions on this.

Please send the requested details via the Reply privately to the author option. If this option is not available, you may send the details directly to our googleadsa...@google.com alias by referring to this thread.

Best regards,

Google Logo
Jakeia Sabrina
Google Ads API Team
 

ref:_00D1U1174p._5004Q2aNUGo:ref

Shawn Naquin

unread,
May 10, 2022, 12:47:43 PM5/10/22
to Google Ads API and AdWords API Forum

Hello,

google has responded that they are looking into the issue. However, it has been more than 1 week. I cannot remove labels from this account in the browser Gui or with the API. Anybody out there have a workaround? Thanks.

Google Ads API Forum Advisor

unread,
May 11, 2022, 9:33:44 AM5/11/22
to sna...@themorangroup.net, adwor...@googlegroups.com
Hello,

We're still looking into this, and I'll let you know as soon as we have any more information to share.

Regards,
Mike, Google Ads API Team

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