{"record":{"id":"958c4e76144c3911","repo":"eyaltoledano/claude-task-master","slug":"google-cloud-location-is-required-for-vertex-ai-s","errorCode":null,"errorMessage":"Google Cloud location is required for Vertex AI. Set VERTEX_LOCATION environment variable (e.g., \"us-central1\").","messagePattern":"Google Cloud location is required for Vertex AI\\. Set VERTEX_LOCATION environment variable \\(e\\.g\\., \"us-central1\"\\)\\.","errorType":"validation","errorClass":"VertexConfigError","httpStatus":null,"severity":"critical","filePath":"src/ai-providers/google-vertex.js","lineNumber":116,"sourceCode":"\t\t\t);\n\t\t}\n\n\t\t// Project ID is required for Vertex AI\n\t\tif (\n\t\t\t!projectId ||\n\t\t\t(typeof projectId === 'string' && projectId.trim().length === 0)\n\t\t) {\n\t\t\tthrow new VertexConfigError(\n\t\t\t\t'Google Cloud project ID is required for Vertex AI. Set VERTEX_PROJECT_ID environment variable.'\n\t\t\t);\n\t\t}\n\n\t\t// Location is required for Vertex AI\n\t\tif (\n\t\t\t!location ||\n\t\t\t(typeof location === 'string' && location.trim().length === 0)\n\t\t) {\n\t\t\tthrow new VertexConfigError(\n\t\t\t\t'Google Cloud location is required for Vertex AI. Set VERTEX_LOCATION environment variable (e.g., \"us-central1\").'\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Creates and returns a Google Vertex AI client instance.\n\t * @param {object} params - Parameters for client initialization\n\t * @param {string} [params.apiKey] - Google API key\n\t * @param {string} params.projectId - Google Cloud project ID\n\t * @param {string} params.location - Google Cloud location (e.g., \"us-central1\")\n\t * @param {object} [params.credentials] - Service account credentials object\n\t * @param {string} [params.baseURL] - Optional custom API endpoint\n\t * @returns {Function} Google Vertex AI client function\n\t * @throws {Error} If required parameters are missing or initialization fails\n\t */\n\tgetClient(params) {\n\t\ttry {","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/src/ai-providers/google-vertex.js#L98-L134","documentation":"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').","triggerScenarios":"Using the Vertex provider with VERTEX_LOCATION unset or set to ''/whitespace, or a location param of empty string.","commonSituations":"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.","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"],"exampleFix":"// before\n# .env\nVERTEX_PROJECT_ID=my-gcp-project\n// after\n# .env\nVERTEX_PROJECT_ID=my-gcp-project\nVERTEX_LOCATION=us-central1","handlingStrategy":"validation","validationCode":"function assertVertexLocation() {\n  const location = process.env.VERTEX_LOCATION;\n  if (!location || location.trim().length === 0) {\n    throw new Error('VERTEX_LOCATION must be set to a Vertex AI region, e.g. us-central1');\n  }\n}","typeGuard":"null","tryCatchPattern":"try {\n  await vertexProvider.generateText({ messages, modelId });\n} catch (e) {\n  if (e.name === 'VertexConfigError' || /location is required for Vertex AI/.test(e.message)) {\n    console.error('Set VERTEX_LOCATION (e.g. us-central1) in this environment');\n  } else throw e;\n}","preventionTips":["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"],"tags":["configuration","google-cloud","env-vars","vertex-ai"],"backgroundTag":"missing-env-var","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}