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