GCP

OUT_OF_RANGE - Out of Range: Parameter Value Violation

OUT_OF_RANGE means your parameter value breaches GCP's allowed bounds—disk size exceeds maximum (64 TB) or is below minimum (10 GB), port numbers outside 1-65535, or array indices beyond valid bounds. This client-side error happens during parameter validation in the control plane. Most common in Compute Engine with disk sizes and port numbers, but also surfaces in Cloud SQL with storage size limits and backup retention days, GKE with node pool and cluster size constraints, and BigQuery with query size limits. Range limits vary by service and resource type—standard disks have different limits than SSDs, and Cloud SQL tier limits differ by instance size.

#Common Causes

  • Value Range Violation: A parameter value exceeds the maximum or is below the minimum allowed value. For example, disk sizes have minimum (10 GB) and maximum (64 TB) limits that vary by disk type and zone. Cloud SQL storage sizes have different limits by instance tier.
  • Index Out of Bounds: Array or list indices are outside valid bounds. For example, accessing a list item that doesn't exist, or using an index greater than the array size.
  • Invalid Range Specification: A range parameter (e.g., port ranges, IP ranges, CIDR blocks) is malformed or outside allowed values. For example, port numbers must be 1-65535, and CIDR blocks must be valid network ranges.
  • Service-Specific Limits: Range limits vary by service and resource type. Disk size limits vary by disk type (standard, SSD, local SSD) and zone. Cloud SQL storage limits vary by instance tier (db-f1-micro has different limits than db-n1-standard).

Solutions

  1. 1Step 1: Diagnose - Check the error message for the specific parameter and value that's out of range. GCP error messages typically identify the parameter and the valid range.
  2. 2Step 2: Diagnose - Query valid ranges for the parameter. For disk sizes: gcloud compute disk-types list --filter="zone:ZONE" --format="table(name,validDiskSize)"
  3. 3Step 3: Fix - Use a value within the allowed range. Check API documentation for minimum and maximum limits.
  4. 4Step 4: Fix - For disk sizes, use a valid size within the disk type's range. For Cloud SQL, check storage size limits for your instance tier.
  5. 5Step 5: Verify - Retry the operation with a value within the valid range.

</>Code Examples

Range Validation
1# This script validates parameter values are within allowed ranges to avoid OUT_OF_RANGE errors
2
3ZONE="us-central1-a"
4PROJECT_ID="my-project"
5
6# Step 1: Define your desired disk size (example)
7DESIRED_DISK_SIZE=5  # GB
8
9# Step 2: Check valid disk size ranges for the zone
10echo "Checking valid disk size ranges for zone $ZONE..."
11DISK_TYPES=$(gcloud compute disk-types list \
12  --filter="zone:$ZONE" \
13  --format="table(name,validDiskSize.minRangeGb,validDiskSize.maxRangeGb)" \
14  --project $PROJECT_ID)
15
16echo "$DISK_TYPES"
17
18# Step 3: Validate disk size against minimum (example: 10 GB minimum for most disk types)
19MIN_DISK_SIZE=10
20MAX_DISK_SIZE=65536  # 64 TB in GB
21
22if [ $DESIRED_DISK_SIZE -lt $MIN_DISK_SIZE ]; then
23  echo "ERROR: Disk size $DESIRED_DISK_SIZE GB is below minimum $MIN_DISK_SIZE GB"
24  exit 1
25fi
26
27if [ $DESIRED_DISK_SIZE -gt $MAX_DISK_SIZE ]; then
28  echo "ERROR: Disk size $DESIRED_DISK_SIZE GB exceeds maximum $MAX_DISK_SIZE GB"
29  exit 1
30fi
31
32echo "Disk size $DESIRED_DISK_SIZE GB is within valid range"
33
34# Step 4: Example for port validation (must be 1-65535)
35PORT=8080
36if [ $PORT -lt 1 ] || [ $PORT -gt 65535 ]; then
37  echo "ERROR: Port $PORT is out of range (1-65535)"
38  exit 1
39fi
40
41# Step 5: Create resource with validated parameter
42echo "Creating disk with validated size..."
43gcloud compute disks create my-disk \
44  --size $DESIRED_DISK_SIZE \
45  --zone $ZONE \
46  --project $PROJECT_ID

Related Errors

Provider Information

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

OUT_OF_RANGE - Out of Range: Parameter Value Violation | GCP Error Reference | Error Code Reference