eyaltoledano/claude-task-master · critical · VertexConfigError
Google Cloud location is required for Vertex AI. Set VERTEX_
Error message
Google Cloud location is required for Vertex AI. Set VERTEX_LOCATION environment variable (e.g., "us-central1").
What it means
Vertex AI calls are region-scoped, so a Google Cloud location (region) must be supplied. GoogleVertexProvider.validateAuth throws VertexConfigError when location is missing or an empty/whitespace string; it is normally read from the VERTEX_LOCATION environment variable (e.g. 'us-central1').
Source
Thrown at src/ai-providers/google-vertex.js:116
);
}
// Project ID is required for Vertex AI
if (
!projectId ||
(typeof projectId === 'string' && projectId.trim().length === 0)
) {
throw new VertexConfigError(
'Google Cloud project ID is required for Vertex AI. Set VERTEX_PROJECT_ID environment variable.'
);
}
// Location is required for Vertex AI
if (
!location ||
(typeof location === 'string' && location.trim().length === 0)
) {
throw new VertexConfigError(
'Google Cloud location is required for Vertex AI. Set VERTEX_LOCATION environment variable (e.g., "us-central1").'
);
}
}
/**
* Creates and returns a Google Vertex AI client instance.
* @param {object} params - Parameters for client initialization
* @param {string} [params.apiKey] - Google API key
* @param {string} params.projectId - Google Cloud project ID
* @param {string} params.location - Google Cloud location (e.g., "us-central1")
* @param {object} [params.credentials] - Service account credentials object
* @param {string} [params.baseURL] - Optional custom API endpoint
* @returns {Function} Google Vertex AI client function
* @throws {Error} If required parameters are missing or initialization fails
*/
getClient(params) {
try {View on GitHub (pinned to c0c98d367c)
Solutions
- Set VERTEX_LOCATION to a valid Vertex AI region (e.g. export VERTEX_LOCATION=us-central1)
- Add VERTEX_LOCATION to your .env file and ensure it is loaded
- Verify the region supports the model/endpoint you are calling
Example fix
// before # .env VERTEX_PROJECT_ID=my-gcp-project // after # .env VERTEX_PROJECT_ID=my-gcp-project VERTEX_LOCATION=us-central1
Defensive patterns
Strategy: validation
Validate before calling
function assertVertexLocation() {
const location = process.env.VERTEX_LOCATION;
if (!location || location.trim().length === 0) {
throw new Error('VERTEX_LOCATION must be set to a Vertex AI region, e.g. us-central1');
}
} Type guard
null
Try / catch
try {
await vertexProvider.generateText({ messages, modelId });
} catch (e) {
if (e.name === 'VertexConfigError' || /location is required for Vertex AI/.test(e.message)) {
console.error('Set VERTEX_LOCATION (e.g. us-central1) in this environment');
} else throw e;
} Prevention
- Add VERTEX_LOCATION to .env templates alongside VERTEX_PROJECT_ID
- Validate region support for your chosen model before deployment
- Include VERTEX_LOCATION in a startup preflight env check
When it happens
Trigger: Using the Vertex provider with VERTEX_LOCATION unset or set to ''/whitespace, or a location param of empty string.
Common situations: New environment missing the env var; copying an .env template without filling VERTEX_LOCATION; assuming a default region exists when none is applied; typo producing an empty value after trimming.
Understand the failure class
Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.
Related errors
- Google Cloud project ID is required for Vertex AI. Set VERTE
- Vertex AI requires authentication. Provide one of the follow
- Model "${model}" is not available for provider "${this.getNa
- AUTHENTICATION_ERROR
- NO_BRIEF_SELECTED
AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29).
Data as JSON: /api/errors/958c4e76144c3911.
Report an issue: GitHub.