{"record":{"id":"f1ec4b3dd7030aa4","repo":"eyaltoledano/claude-task-master","slug":"google-cloud-project-id-is-required-for-vertex-ai","errorCode":null,"errorMessage":"Google Cloud project ID is required for Vertex AI. Set VERTEX_PROJECT_ID environment variable.","messagePattern":"Google Cloud project ID is required for Vertex AI\\. Set VERTEX_PROJECT_ID environment variable\\.","errorType":"validation","errorClass":"VertexConfigError","httpStatus":null,"severity":"critical","filePath":"src/ai-providers/google-vertex.js","lineNumber":106,"sourceCode":"\n\t\t// Check for API key OR service account credentials\n\t\tconst hasValidApiKey = this.isValidCredential(apiKey);\n\t\tconst hasValidCredentials = this.isValidCredential(credentials);\n\n\t\tif (!hasValidApiKey && !hasValidCredentials) {\n\t\t\tthrow new VertexAuthError(\n\t\t\t\t'Vertex AI requires authentication. Provide one of the following:\\n' +\n\t\t\t\t\t'  • GOOGLE_API_KEY environment variable (typical for API-based auth), OR\\n' +\n\t\t\t\t\t'  • GOOGLE_APPLICATION_CREDENTIALS pointing to a service account JSON file (recommended for production)'\n\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","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/src/ai-providers/google-vertex.js#L88-L124","documentation":"Vertex AI requires a Google Cloud project ID to route requests. GoogleVertexProvider.validateAuth throws VertexConfigError when projectId is missing or an empty/whitespace string. The project ID normally comes from the VERTEX_PROJECT_ID environment variable.","triggerScenarios":"Using the Vertex provider with VERTEX_PROJECT_ID unset or set to ''/whitespace, or a projectId param passed as an empty string.","commonSituations":"Deploying to a new environment (CI, container, serverless) where only the API key was copied over; forgetting to add VERTEX_PROJECT_ID to .env; project variable shadowed by an empty default in config loading.","solutions":["Set VERTEX_PROJECT_ID in the environment (e.g. export VERTEX_PROJECT_ID=my-gcp-project)","Add VERTEX_PROJECT_ID to your .env file and ensure it is loaded","Verify no empty-string default overwrites the env var in config code","Confirm the project ID exists and the Vertex AI API is enabled in that project"],"exampleFix":"// before\n# .env\nGOOGLE_API_KEY=...\n// after\n# .env\nGOOGLE_API_KEY=...\nVERTEX_PROJECT_ID=my-gcp-project","handlingStrategy":"validation","validationCode":"function assertVertexProjectId() {\n  const projectId = process.env.VERTEX_PROJECT_ID;\n  if (!projectId || projectId.trim().length === 0) {\n    throw new Error('VERTEX_PROJECT_ID must be set to a Google Cloud project ID');\n  }\n}","typeGuard":"null","tryCatchPattern":"try {\n  await vertexProvider.generateText({ messages, modelId });\n} catch (e) {\n  if (e.name === 'VertexConfigError' || /project ID is required for Vertex AI/.test(e.message)) {\n    console.error('Set VERTEX_PROJECT_ID in this environment');\n  } else throw e;\n}","preventionTips":["Add VERTEX_PROJECT_ID to .env templates and document it in setup docs","Run an env-var preflight (project + location + auth) at startup","Ensure .env files are loaded and copied into CI/container environments"],"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"}