MODEL DDL statements and ML functions in Spanner invoke
Gemini Enterprise Agent Platform endpoints and can fail due to various reasons:

| Error Code | Error Message | Possible cause | Possible solution |
|---|---|---|---|
| CANCELLED | `Call to Agent Platform endpoint {ENDPOINT} was cancelled due to query cancellation.` | Query was cancelled by the client application. | Investigate why your client cancelled the query. |
| DEADLINE_EXCEEDED | `Agent Platform endpoint {ENDPOINT} exceeded the call deadline.` | Query deadline is too short. | Increase query deadline on the client. |
| - | - | Endpoint was too busy. | See Agent Platform monitoring and deploy more nodes. |
| FAILED_PRECONDITION | `Agent Platform endpoint {ENDPOINT} returned failed precondition error.` | Endpoint has no models deployed. | Deploy models to the endpoint. |
| INTERNAL | `Unknown error when accessing Agent Platform endpoint {ENDPOINT}.` | Unexpected internal error. | [Use failover endpoints](https://docs.cloud.google.com/spanner/docs/ml-tutorial.md.txt#failover_models) or open a support ticket. |
| INVALID_ARGUMENT | ` Invalid request to Agent Platform endpoint {ENDPOINT}. Make sure that Agent Platform endpoint and Spanner model schema match. ` | Spanner model schema and Agent Platform endpoint schema do not match | Update Spanner model's schema. |
| NOT_FOUND | `Agent Platform endpoint {ENDPOINT} not found.` | Endpoint was deleted. | Update Spanner model's schema. |
| PERMISSION_DENIED | `Access to Agent Platform endpoint {ENDPOINT} was denied.` | Spanner service agent does not have permissions to access the endpoint | [Grant service agent role permissions](https://docs.cloud.google.com/spanner/docs/ml-tutorial.md.txt#configure_access_for_to_endpoints) |
| - | `-` | VPC SC error | See Agent Platform error message and follow [VPC SC troubleshooting](https://docs.cloud.google.com/vpc-service-controls/docs/troubleshooting.md.txt) |
| RESOURCE_EXHAUSTED | `Agent Platform endpoint {ENDPOINT} quota has been exceeded.` | Too many requests to Agent Platform. | [Increase online prediction quota](https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/quotas.md.txt#quota_increases) |
| UNAVAILABLE | `Could not create service agent for project {PROJECT}.` | Service Usage API issue. | [Create service agent manually](https://docs.cloud.google.com/spanner/docs/ml-tutorial.md.txt#configure_access_for_to_endpoints) |
| - | `Agent Platform endpoint {ENDPOINT} is unavailable.` | Too many requests to Agent Platform. | Deploy more nodes. |
| - | - | Agent Platform has a regional issue | [Use failover endpoints](https://docs.cloud.google.com/spanner/docs/ml-tutorial.md.txt#failover_models) |

Errors returned by Spanner include the original Agent Platform errors as `google.rpc.Status` [details messages](https://docs.cloud.google.com/apis/design/errors#error_details). For more information, see the following:

- [Troubleshoot environment setup for Agent Runtime](https://docs.cloud.google.com/gemini-enterprise-agent-platform/troubleshooting/runtime-setup.md.txt)
- [Troubleshoot creating an agent using Agent Runtime](https://docs.cloud.google.com/gemini-enterprise-agent-platform/troubleshooting/agent-creation.md.txt)
- [Troubleshoot managing deployed agents for Agent Runtime](https://docs.cloud.google.com/gemini-enterprise-agent-platform/troubleshooting/managing-deployed-agents.md.txt)
- [Code execution troubleshooting](https://docs.cloud.google.com/gemini-enterprise-agent-platform/troubleshooting/code-execution.md.txt)
- [Troubleshooting Agent Platform Memory Bank](https://docs.cloud.google.com/gemini-enterprise-agent-platform/troubleshooting/memory-bank.md.txt)

<br />

Both Spanner and Agent Platform provide monitoring dashboards and write logs to Cloud Logging, which can contain additional details.