High severity beginner · Fix: 2-5 min

ValueError

vertexai.exceptions.ValueError: Location region not supported

What this error means
The VertexAI Python client throws a ValueError when the specified location region is not supported or invalid during initialization.

Stack trace

traceback
Traceback (most recent call last):
  File "app.py", line 10, in <module>
    vertexai.init(project=project_id, location=region)
  File "/usr/local/lib/python3.9/site-packages/vertexai/__init__.py", line 45, in init
    raise ValueError(f"Location region '{location}' not supported.")
ValueError: Location region 'us-central9' not supported.
QUICK FIX
Verify and correct the 'location' parameter in vertexai.init() to a supported region string exactly as documented.

Why it happens

This error occurs because the location region passed to vertexai.init() is either misspelled, deprecated, or not enabled for your Google Cloud project. The Vertex AI SDK validates the region against a list of supported regions and raises this error if the region is invalid.

Detection

Check the region parameter passed to vertexai.init() before runtime; validate it against the official list of supported Vertex AI regions to catch misconfiguration early.

Causes & fixes

1

Typo or invalid region string passed to vertexai.init()

✓ Fix

Correct the region string to a valid supported region such as 'us-central1' or 'us-east1'.

2

Region is valid but not enabled for your Google Cloud project

✓ Fix

Enable the Vertex AI API and services in the Google Cloud Console for the specified region.

3

Using an outdated Vertex AI SDK version that does not recognize newer regions

✓ Fix

Upgrade the vertexai Python package to the latest version that supports all current regions.

Code: broken vs fixed

Broken - triggers the error
python
import os
from vertexai import vertexai

project_id = os.environ.get('GOOGLE_CLOUD_PROJECT')
region = 'us-central9'  # Invalid region

vertexai.init(project=project_id, location=region)  # This line raises ValueError
Fixed - works correctly
python
import os
from vertexai import vertexai

project_id = os.environ.get('GOOGLE_CLOUD_PROJECT')
region = 'us-central1'  # Corrected region

vertexai.init(project=project_id, location=region)  # Fixed: valid region
print('VertexAI initialized successfully in region:', region)
Corrected the 'location' parameter to a valid supported region string 'us-central1' to prevent the ValueError during initialization.

Workaround

Wrap the vertexai.init call in a try/except block catching ValueError, log the invalid region, and fallback to a default supported region programmatically.

Prevention

Always validate the region string against the official Google Cloud Vertex AI supported regions list before calling vertexai.init, and keep the SDK updated to support new regions.

Python 3.9+ · vertexai >=1.0.0 · tested on 1.2.0
Verified 2026-04
Verify ↗

Community Notes

No notes yetBe the first to share a version-specific fix or tip.