Installation
copilot plugin marketplace add samueltauil/skills-hub
copilot plugin install data-manager-api-troubleshooting@skills-hub
Works with GitHub Copilot CLI and VS Code (enable chat.plugins.enabled).
Plugin data-manager-api-troubleshooting v1.0.0 follows the Agent Plugins spec.
gh skills-hub install data-manager-api-troubleshooting Don't have the extension? Run gh extension install samueltauil/skills-hub first.
Download and extract to your repository:
.github/skills/data-manager-api-troubleshooting/ Extract the ZIP to .github/skills/ in your repo. The folder name must match data-manager-api-troubleshooting for Copilot to auto-discover it.
Skill Files (3)
SKILL.md 6.7 KB
---
name: data-manager-api-troubleshooting
description: >-
Diagnoses and fixes errors, warnings, and missing data for Data Manager API
event and audience ingestion requests. Use when an IngestEvents,
IngestAudienceMembers, RemoveAudienceMembers, RemoveAllAudienceMembers, or
RetrieveRequestStatus call fails (INVALID_ARGUMENT, REQUIRED_FIELD_MISSING,
INVALID_HEX_ENCODING, PERMISSION_DENIED, UNAUTHENTICATED,
RESOURCE_EXHAUSTED, INVALID_REQUEST_ID), when
a response has fieldWarnings, when checking request status or diagnostics,
when request status shows FAILED or PARTIAL_SUCCESS or processing errors,
when finding which records failed, or when a request returned 200 but
conversions or audience members are missing. Don't
use for writing new ingestion code (use the data-manager-api-event-ingestion
or data-manager-api-audience-ingestion skills) or first-time credential
setup (use the data-manager-api-setup skill).
metadata:
version: "1.0.0"
category: GoogleAds
---
# Data Manager API Troubleshooting
The Data Manager API reports problems in three places, at three different times.
## Step 1: Classify the problem
Ask for the exact error payload, response, or diagnostics output if the user
hasn't shared it.
| Symptom | When | What it means | Go to |
| :--- | :--- | :--- | :--- |
| Request throws an exception or returns 4xx/5xx | Immediately | The **entire** request was rejected. No records were ingested. | [Step 2](#step-2-fix-request-errors) |
| Request succeeds with `field_warnings` | Immediately | The request was accepted, but the flagged field had an issue (for example, an invalid or missing optional value). Don't resend. Fix the source data for future requests. | None |
| Request succeeded, but data is missing or lower than expected | Check `retrieve_request_status` 30 minutes to 24 hours later | Records can still fail during asynchronous processing. Diagnostics show per-destination results, including which records failed. | [Step 3](#step-3-check-request-status-and-diagnostics) |
## Step 2: Fix request errors
The API uses a fast-fail model: if any record fails synchronous validation, the
whole request fails and no records are processed. Fix the problem and resend the
**entire** request. To confirm a fix first, send the ingestion request with
`validate_only` set to `true`.
### Read the full error
For `INVALID_ARGUMENT`, the top-level `message` is always generic ("There was a
problem with the request."). Read **every** entry in the `google.rpc.BadRequest`
detail's `field_violations`, including `field` (a path with list indexes, such
as `events.events[1].user_data.user_identifiers[2]`), `reason` (an
`ErrorReason`), and `description`. For any error, also log `request_id` from
`google.rpc.RequestInfo` and include it in support requests.
In Python (`google.api_core.exceptions.GoogleAPICallError`), read `err.details`:
```python
from google.api_core import exceptions
from google.rpc import error_details_pb2
try:
...
except exceptions.GoogleAPICallError as err:
for detail in err.details:
if isinstance(detail, error_details_pb2.BadRequest):
for v in detail.field_violations:
print(v.field, v.reason, v.description)
elif isinstance(detail, error_details_pb2.RequestInfo):
print("request_id:", detail.request_id)
```
### Fix by error code
| Error code | What to do |
| :--- | :--- |
| `INVALID_ARGUMENT` (400) | Follow [Fix INVALID_ARGUMENT errors](references/request-errors.md#fix-invalid_argument-errors). |
| `UNAUTHENTICATED` (401), `PERMISSION_DENIED` (403) | Read `ErrorInfo.reason`, then follow [Permission errors](references/request-errors.md#permission-errors). |
| `RESOURCE_EXHAUSTED` (429) | Check `ErrorInfo.metadata.quota_limit`. For a per-minute limit, resend with exponential backoff and jitter. For a daily limit, don't resend until the quota resets at midnight Pacific Time. In both cases, reduce the request count by batching more records per request (up to 2,000 events or 10,000 audience members) and sending at most 10 requests concurrently. |
| `RetrieveRequestStatus` fails with `INVALID_REQUEST_ID` or `REQUEST_TOO_OLD` | Status exists only for recent requests that succeeded and didn't set `validate_only`. For `INVALID_REQUEST_ID`, check that the ID is the `request_id` from a successful, non-validation ingestion response (if the original request failed, fix it using its own error). For `REQUEST_TOO_OLD`, diagnostics are no longer available. |
For other error codes, check whether the error can be retried before resending.
See
[Best practices for error handling](https://developers.google.com/data-manager/api/devguides/concepts/understand-errors.md.txt#best-practices-for-error-handling).
## Step 3: Check request status and diagnostics
Each destination in the response has an overall `request_status`, error and
warning counts, and a request-type status with record and identifier counts.
Some audience data also has a match rate. Field names differ by request type
and data type. Use the fields in
[Request status and diagnostics](references/request-status.md).
### Requirements and timing
* Diagnostics exist only for requests that succeeded and didn't set
`validate_only`.
* Wait at least 30 minutes after ingestion, then poll with exponential backoff
until every destination reaches `SUCCESS`, `PARTIAL_SUCCESS`, or `FAILED`.
Processing can take up to 24 hours. When writing code that reads request
status, handle destinations still in `PROCESSING` by polling again later
instead of reporting their results.
### Map records to their errors and warnings
`record_indices` are 0-based positions in the original request's `events` or
`audience_members` list. When a user asks which records failed or wants to fix
them, invert `error_info.error_counts` and `warning_info.warning_counts` for
each destination into a per-record list of errors and warnings. Resend only the
corrected records that had errors, and only to the destinations where they
failed. For warning-only records, fix the issue for future uploads.
To find what a processing reason means and how to fix it, see
[Processing reasons](references/request-status.md#processing-reasons).
## References
* [Request errors](references/request-errors.md)
* [Request status and diagnostics](references/request-status.md)
* [Understand API errors](https://developers.google.com/data-manager/api/devguides/concepts/understand-errors.md.txt)
* [Diagnostics](https://developers.google.com/data-manager/api/devguides/diagnostics.md.txt)
* [Configure destinations and headers](https://developers.google.com/data-manager/api/devguides/concepts/destinations.md.txt)
* [Best practices](https://developers.google.com/data-manager/api/devguides/concepts/best-practices.md.txt)
* [Limits and quotas](https://developers.google.com/data-manager/api/devguides/limits.md.txt)
request-errors.md 4.0 KB
# Request errors
Use this reference to fix synchronous errors from ingestion requests.
## Contents
* [Fix INVALID_ARGUMENT errors](#fix-invalid_argument-errors)
* [Fields required by use case](#fields-required-by-use-case)
* [Permission errors](#permission-errors)
## Fix INVALID_ARGUMENT errors
1. For each `field_violations` entry, use the `field` path to find where the
problem is: `destinations[...]` points to destination or account settings,
and `events.events[N]` or `audience_members.audience_members[N]` points to
record N. The `reason`, an
[`ErrorReason`](https://developers.google.com/data-manager/api/reference/rest/v1/ErrorReason),
says what's wrong.
2. Match the violation to the
[client-side validation](https://developers.google.com/data-manager/api/devguides/concepts/best-practices.md.txt#client-side-validation)
check it breaks:
| Violation | Check |
| :--- | :--- |
| `REQUIRED_FIELD_MISSING` inside a compound object, such as `address` | Include the object only when all its required fields are present (`address` needs `given_name`, `family_name`, `region_code`, and `postal_code`). Otherwise drop the whole object. |
| `REQUIRED_FIELD_MISSING` on any other field, or `NO_IDENTIFIERS_PROVIDED` | The field or identifier is required for this destination and use case. See [Fields required by use case](#fields-required-by-use-case). |
| `INVALID_HEX_ENCODING`, `INVALID_BASE64_ENCODING`, `INVALID_SHA256_FORMAT` | Check that the value was hashed, and that the request's `encoding` field (`HEX` or `BASE64`) matches how the hashed values were encoded. |
For other reasons, see
[Format user data](https://developers.google.com/data-manager/api/devguides/concepts/formatting.md.txt).
3. Fix the cause in the code that builds requests so later batches pass, not
only in the failing records.
4. A failed response might not list every problem in the request. After
fixing the reported violations, resend with `validate_only` set to `true`
until the request passes, then resend it with `validate_only` set to
`false`.
### Fields required by use case
Fields marked optional in the API reference can be required for a specific
destination and use case, such as `transaction_id` for some event use cases or
`terms_of_service` for Customer Match uploads. Check the implementation guide
for the use case and link the user to it. For example, the guide for Google Ads
offline conversions is
[Send events](https://developers.google.com/data-manager/api/devguides/events/google-ads/offline/send-events.md.txt),
and the guide for Google Ads Customer Match is
[Upload data](https://developers.google.com/data-manager/api/devguides/audiences/google-ads/customer-match/upload-data.md.txt).
Every events **Send events** guide has an **Event field requirements** section
for required fields and an **Identifier requirements** section for the
identifiers each event needs. Check the section that matches the violation.
To find the guide for another use case, use the
`data-manager-api-event-ingestion` or `data-manager-api-audience-ingestion`
skill, or start from the
[Events overview](https://developers.google.com/data-manager/api/devguides/events.md.txt)
or the
[Audiences overview](https://developers.google.com/data-manager/api/devguides/audiences.md.txt).
## Permission errors
`UNAUTHENTICATED`, `SERVICE_DISABLED`, or a token without the
`https://www.googleapis.com/auth/datamanager` scope are setup problems. Use the
`data-manager-api-setup` skill.
`PERMISSION_DENIED` with valid credentials is usually an access path problem:
for ingestion requests, the API checks access using each `Destination`, not
request headers; for resource management requests (such as managing user lists
or partner links), it uses request headers (`login-account` and
`linked-account`). For the fields or headers to set in each access scenario, see
[Configure destinations and headers](https://developers.google.com/data-manager/api/devguides/concepts/destinations.md.txt).
request-status.md 3.5 KB
# Request status and diagnostics
Use this reference to read `RetrieveRequestStatusResponse` diagnostics for
event and audience requests.
## Status fields by request type
`RetrieveRequestStatusResponse.request_status_per_destination[]` has one entry
per destination:
```
destination
request_status # SUCCESS, PROCESSING, FAILED, PARTIAL_SUCCESS
error_info.error_counts[] # reason, record_count, record_indices[]
warning_info.warning_counts[] # same fields as error_counts
# Exactly one of, set by the original request type:
events_ingestion_status # IngestEvents: record_count
audience_members_ingestion_status # IngestAudienceMembers: see table below
audience_members_removal_status # RemoveAudienceMembers: see table below
remove_all_audience_members_status # RemoveAllAudienceMembers: no fields
```
`audience_members_ingestion_status` and `audience_members_removal_status` each
contain exactly one status field, set by the type of audience data in the
request. Every status field has `record_count`, plus:
| Ingestion status field | Removal status field | Other fields |
| :--- | :--- | :--- |
| `user_data_ingestion_status` | `user_data_removal_status` | `user_identifier_count`. Ingestion also has `upload_match_rate_range`. |
| `mobile_data_ingestion_status` | `mobile_data_removal_status` | `mobile_id_count` |
| `pair_data_ingestion_status` | `pair_data_removal_status` | `pair_id_count` |
| `user_id_data_ingestion_status` | `user_id_data_removal_status` | `user_id_count` |
| `ppid_data_ingestion_status` | `ppid_data_removal_status` | `ppid_count` |
| `composite_data_ingestion_status` | `composite_data_removal_status` | `data_type_counts[]` (`type`, `count`). Ingestion also has `upload_match_rate_range`. |
| `google_user_id_data_ingestion_status` | `google_user_id_data_removal_status` | `google_user_id_count` |
| `partner_provided_id_data_ingestion_status` | `partner_provided_id_data_removal_status` | `partner_provided_id_count` |
```python
from google.ads.datamanager_v1 import IngestionServiceClient, RetrieveRequestStatusRequest
client = IngestionServiceClient()
response = client.retrieve_request_status(
RetrieveRequestStatusRequest(request_id=request_id)
)
for status in response.request_status_per_destination:
# If status.request_status is PROCESSING, wait and poll again.
# Otherwise, read the fields listed above.
...
```
If a field is missing from this list, see
[`RequestStatusPerDestination`](https://developers.google.com/data-manager/api/reference/rpc/google.ads.datamanager.v1#requeststatusperdestination)
or
[Check event or audience status per destination](https://developers.google.com/data-manager/api/devguides/diagnostics.md.txt#event_or_audience_status)
instead of searching the client library or other skills.
## Processing reasons
`ErrorCount.reason` is a
[`ProcessingErrorReason`](https://developers.google.com/data-manager/api/reference/rpc/google.ads.datamanager.v1#processingerrorreason),
and `WarningCount.reason` is a
[`ProcessingWarningReason`](https://developers.google.com/data-manager/api/reference/rpc/google.ads.datamanager.v1#processingwarningreason).
Look up a reason's meaning in the reference.
A warning means the record was processed, but part of it wasn't used. For
example, `PROCESSING_WARNING_REASON_USER_IDENTIFIER_DECRYPTION_ERROR` means the
encrypted user identifiers couldn't be decrypted, so the event was processed
using only its ad identifiers. Don't resend warning-only records. Fix the source
data for future uploads.
License (Apache-2.0)
View full license text
Licensed under the Apache License, Version 2.0. See https://github.com/google/skills/blob/main/LICENSE