Troubleshooting
✅ Fresh -- Updated March 2026 from official Google Cloud documentation.
Common Google Cloud API issues and their resolutions.
Troubleshooting Flow
Common Issues and Fixes
Issue: "API not enabled" (403)
Symptom:
json
{
"error": {
"code": 403,
"message": "Cloud Storage API has not been used in project 123456 before or it is disabled.",
"status": "PERMISSION_DENIED"
}
}Fix:
bash
gcloud services enable storage.googleapis.comIssue: "The caller does not have permission" (403)
Symptom:
json
{
"error": {
"code": 403,
"message": "The caller does not have permission",
"status": "PERMISSION_DENIED"
}
}Fix:
bash
# Check current roles
gcloud projects get-iam-policy PROJECT_ID \
--flatten="bindings[].members" \
--filter="bindings.members:YOUR_EMAIL" \
--format="table(bindings.role)"
# Grant the needed role
gcloud projects add-iam-policy-binding PROJECT_ID \
--member="serviceAccount:SA_EMAIL" \
--role="roles/storage.objectAdmin"Issue: "Request had invalid authentication credentials" (401)
Symptom:
json
{
"error": {
"code": 401,
"message": "Request had invalid authentication credentials.",
"status": "UNAUTHENTICATED"
}
}Fix:
bash
# Re-authenticate
gcloud auth login
# For application default credentials
gcloud auth application-default login
# Verify token works
gcloud auth print-access-token
# Test with curl
curl -H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://storage.googleapis.com/storage/v1/b?project=PROJECT_ID"Issue: "Quota exceeded" (429)
Symptom:
json
{
"error": {
"code": 429,
"message": "Quota exceeded for quota metric 'Requests' ...",
"status": "RESOURCE_EXHAUSTED"
}
}Fix:
- Implement exponential backoff in your code
- Request a quota increase in the Console:
https://console.cloud.google.com/iam-admin/quotas - Batch requests where possible
- Cache responses to reduce API calls
Issue: "Not found" (404)
Symptom:
json
{
"error": {
"code": 404,
"message": "Resource not found",
"status": "NOT_FOUND"
}
}Fix:
bash
# Verify you're using the correct project
gcloud config get-value project
# List resources to confirm they exist
gcloud pubsub topics list --project=PROJECT_ID
# Check the resource name format
# Correct: projects/my-project/topics/my-topic
# Incorrect: my-topic (missing project prefix)Issue: "Invalid JSON payload" (400)
Symptom:
json
{
"error": {
"code": 400,
"message": "Invalid JSON payload received.",
"status": "INVALID_ARGUMENT"
}
}Fix:
bash
# Validate your JSON
echo '{"field": "value"}' | python -m json.tool
# Check Content-Type header
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-d '{"valid": "json"}' \
"https://SERVICE.googleapis.com/v1/RESOURCE"Issue: Slow API responses
Diagnosis:
bash
# Check latency metrics
gcloud monitoring metrics list \
--filter="metric.type=serviceruntime.googleapis.com/api/request_latencies"
# Time a request
time curl -s -o /dev/null -w "%{time_total}" \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://SERVICE.googleapis.com/v1/RESOURCE"Fixes:
- Use regional endpoints if available (closer to your workload)
- Enable HTTP/2 for multiplexing
- Use partial responses (
?fields=name,status) to reduce payload - Use pagination with smaller page sizes
- Cache responses client-side
Debug Checklist
- Read the full error -- Check
message,status, anddetails[] - Verify credentials --
gcloud auth print-access-tokensucceeds - Check API enabled --
gcloud services list --enabled | grep SERVICE - Check IAM -- Correct roles assigned to the calling identity
- Check quotas -- Not hitting rate or allocation limits
- Test with curl -- Isolate the issue from your application code
- Enable debug logging -- Turn on SDK verbose logging
- Check Audit Logs -- Server-side view of the request
bash
# Enable verbose logging for Python client
import logging
logging.basicConfig(level=logging.DEBUG)
# Enable verbose logging for gcloud
gcloud --verbosity=debug SERVICE COMMANDGCP Status Dashboard
Check if there is a known outage:
https://status.cloud.google.com/See Also
- Error Codes Reference -- Complete error code table
- Authentication SOP -- Fix auth issues
- Monitoring Workflow -- Set up monitoring
- Error Handling Design -- Understand the error model