{"record":{"id":"3a10d83c5152c4b2","repo":"eyaltoledano/claude-task-master","slug":"invalid-request-errormessage","errorCode":null,"errorMessage":"Invalid request: ${errorMessage}","messagePattern":"Invalid request: (.+?)","errorType":"exception","errorClass":"VertexConfigError","httpStatus":400,"severity":"error","filePath":"src/ai-providers/google-vertex.js","lineNumber":190,"sourceCode":"\t\t// Handle known error types\n\t\tif (\n\t\t\terror.name === 'VertexAuthError' ||\n\t\t\terror.name === 'VertexConfigError' ||\n\t\t\terror.name === 'VertexApiError'\n\t\t) {\n\t\t\tthrow error;\n\t\t}\n\n\t\t// Handle network/API errors\n\t\tif (error.response) {\n\t\t\tconst statusCode = error.response.status;\n\t\t\tconst errorMessage = error.response.data?.error?.message || error.message;\n\n\t\t\t// Categorize by status code\n\t\t\tif (statusCode === 401 || statusCode === 403) {\n\t\t\t\tthrow new VertexAuthError(`Authentication failed: ${errorMessage}`);\n\t\t\t} else if (statusCode === 400) {\n\t\t\t\tthrow new VertexConfigError(`Invalid request: ${errorMessage}`);\n\t\t\t} else {\n\t\t\t\tthrow new VertexApiError(\n\t\t\t\t\t`API error (${statusCode}): ${errorMessage}`,\n\t\t\t\t\tstatusCode\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\t// Generic error handling\n\t\tthrow new Error(`Vertex AI ${operation} failed: ${error.message}`);\n\t}\n}\n","sourceCodeStart":172,"sourceCodeEnd":203,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/src/ai-providers/google-vertex.js#L172-L203","documentation":"Vertex AI returned HTTP 400, so the provider rethrows it as VertexConfigError with the message 'Invalid request: ...'. This signals a malformed request (bad model name, invalid payload, wrong region) rather than an auth or availability problem. The upstream Google error message is embedded.","triggerScenarios":"getClient()/API call receives error.response.status === 400 from the Vertex AI endpoint; handleError maps it to VertexConfigError.","commonSituations":"Typo'd or unavailable model ID (e.g. model not published in the chosen region), malformed request body for the model type, invalid location (region) string, unsupported parameters for the model, or quota/experimental-model gating returning 400.","solutions":["Check the embedded errorMessage — Google usually names the offending field or model.","Verify the model ID exists in the configured GOOGLE_VERTEX_LOCATION region.","Validate the request payload against the model's documented schema (remove unsupported parameters).","Confirm project/location values are correct and the model is GA/available to your project."],"exampleFix":"// before\n// vertex.getClient({ modelId: 'gemini-not-real', location: 'us-middle1' })\n// after\n// vertex.getClient({ modelId: 'gemini-1.5-pro', location: 'us-central1' })","handlingStrategy":"validation","validationCode":"function validateVertexRequest({ modelId, location }) {\n  const errors = [];\n  if (!modelId || !/^[a-z0-9.-]+$/.test(modelId)) errors.push('modelId missing or malformed');\n  if (!location || !/^[a-z]+-[a-z]+\\d+$/.test(location)) errors.push('location must look like us-central1');\n  if (errors.length) throw new Error('Invalid Vertex config: ' + errors.join('; '));\n}","typeGuard":null,"tryCatchPattern":"try {\n  await vertex.getClient(...);\n} catch (e) {\n  if (/Invalid request:/.test(e.message)) {\n    console.error('Vertex 400:', e.message); // read Google's field-level reason\n    // fix model/region/payload before retrying; do not blind-retry\n    return null;\n  }\n  throw e;\n}","preventionTips":["Pin to model IDs confirmed available in your chosen region","Keep a smoke-test call in CI to catch model deprecations","Validate request payloads against the model's documented schema","Double-check location strings against Google's region list"],"tags":["bad-request","google-vertex","http-400","configuration"],"backgroundTag":"http-400-bad-request","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}