Skip to content

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.com

Issue: "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:

  1. Implement exponential backoff in your code
  2. Request a quota increase in the Console:
    https://console.cloud.google.com/iam-admin/quotas
  3. Batch requests where possible
  4. 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:

  1. Use regional endpoints if available (closer to your workload)
  2. Enable HTTP/2 for multiplexing
  3. Use partial responses (?fields=name,status) to reduce payload
  4. Use pagination with smaller page sizes
  5. Cache responses client-side

Debug Checklist

  1. Read the full error -- Check message, status, and details[]
  2. Verify credentials -- gcloud auth print-access-token succeeds
  3. Check API enabled -- gcloud services list --enabled | grep SERVICE
  4. Check IAM -- Correct roles assigned to the calling identity
  5. Check quotas -- Not hitting rate or allocation limits
  6. Test with curl -- Isolate the issue from your application code
  7. Enable debug logging -- Turn on SDK verbose logging
  8. 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 COMMAND

GCP Status Dashboard

Check if there is a known outage:

https://status.cloud.google.com/

See Also