GCP

UNAVAILABLE - Unavailable: Service Temporarily Down

UNAVAILABLE hits when GCP's service is temporarily down—planned maintenance, traffic overload, or unplanned regional outages prevent the backend from processing requests. This server-side error means GCP's infrastructure is the problem, not your request. Most common in Compute Engine when APIs go down or regions experience outages, but also appears in Cloud SQL during connection failures, GKE when cluster APIs are unavailable, and BigQuery when query services are overloaded. Usually transient—exponential backoff retries typically succeed once service recovers, but regional outages may require switching zones.

#Common Causes

  • Service Maintenance: GCP performs planned maintenance on service infrastructure. Maintenance is typically scheduled and announced. This is transient—waiting for maintenance to complete and retrying helps.
  • Service Overload: The service is experiencing high load and can't process requests. The service may throttle or temporarily reject requests. This is transient—retrying with exponential backoff helps.
  • Regional Outage: The service in a specific region experiences an unplanned outage. Outages may affect all resources in that region. This is transient—waiting for service restoration and retrying helps, or using a different region may work.
  • Service-Specific Behavior: Availability behavior varies by service. Some services recover quickly, others may take longer. Timing isn't guaranteed.

Solutions

  1. 1Step 1: Diagnose - Check GCP status page for known issues: Visit https://status.cloud.google.com/ and check for service outages or maintenance affecting your service/region.
  2. 2Step 2: Diagnose - Check if the error is consistent by retrying the operation multiple times: gcloud compute instances list --project PROJECT_ID If it consistently fails, it may be a persistent issue.
  3. 3Step 3: Diagnose - Check if the error is region-specific by trying operations in a different region: gcloud compute zones list --format="table(name,status)" Then retry your operation in a different zone/region.
  4. 4Step 4: Fix - Implement retry logic with exponential backoff. Retry the operation with increasing delays (e.g., 1s, 2s, 4s, 8s).
  5. 5Step 5: Fix - For regional outages, try operations in a different region if possible: gcloud compute instances create INSTANCE_NAME --zone DIFFERENT_ZONE --project PROJECT_ID
  6. 6Step 6: Verify - If retries succeed, the issue was transient. If retries consistently fail, check the GCP status page and consider contacting GCP support.

</>Code Examples

Unavailable Service Retry Logic
1# This script implements retry logic with exponential backoff for UNAVAILABLE errors
2
3PROJECT_ID="my-project"
4MAX_RETRIES=5
5RETRY_DELAY=1
6
7# Retry function with exponential backoff
8retry_with_backoff() {
9  local max_attempts=$1
10  local delay=$2
11  local attempt=1
12  shift 2
13  local command="$@"
14  
15  while [ $attempt -le $max_attempts ]; do
16    echo "Attempt $attempt of $max_attempts..."
17    
18    if eval "$command"; then
19      echo "Success! Operation completed on attempt $attempt"
20      return 0
21    fi
22    
23    if [ $attempt -lt $max_attempts ]; then
24      echo "Operation failed. Waiting $delay seconds before retry..."
25      sleep $delay
26      delay=$((delay * 2))  # Exponential backoff
27      attempt=$((attempt + 1))
28    else
29      echo "Failed after $max_attempts attempts"
30      echo "Please check:"
31      echo "  1. GCP Status page: https://status.cloud.google.com/"
32      echo "  2. Try a different zone: gcloud compute zones list"
33      echo "  3. Contact GCP support if the issue persists"
34      return 1
35    fi
36  done
37}
38
39# Usage: Retry a gcloud command
40retry_with_backoff $MAX_RETRIES $RETRY_DELAY gcloud compute instances list --project $PROJECT_ID

Related Errors

Provider Information

This error code is specific to GCP services. For more information, refer to the official GCP documentation.

UNAVAILABLE - Unavailable: Service Temporarily Down | GCP Error Reference | Error Code Reference