eyaltoledano/claude-task-master · error · VertexConfigError

Invalid request: ${errorMessage}

Error message

Invalid request: ${errorMessage}

What it means

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.

Source

Thrown at src/ai-providers/google-vertex.js:190

		// Handle known error types
		if (
			error.name === 'VertexAuthError' ||
			error.name === 'VertexConfigError' ||
			error.name === 'VertexApiError'
		) {
			throw error;
		}

		// Handle network/API errors
		if (error.response) {
			const statusCode = error.response.status;
			const errorMessage = error.response.data?.error?.message || error.message;

			// Categorize by status code
			if (statusCode === 401 || statusCode === 403) {
				throw new VertexAuthError(`Authentication failed: ${errorMessage}`);
			} else if (statusCode === 400) {
				throw new VertexConfigError(`Invalid request: ${errorMessage}`);
			} else {
				throw new VertexApiError(
					`API error (${statusCode}): ${errorMessage}`,
					statusCode
				);
			}
		}

		// Generic error handling
		throw new Error(`Vertex AI ${operation} failed: ${error.message}`);
	}
}

View on GitHub (pinned to c0c98d367c)

Solutions

  1. Check the embedded errorMessage — Google usually names the offending field or model.
  2. Verify the model ID exists in the configured GOOGLE_VERTEX_LOCATION region.
  3. Validate the request payload against the model's documented schema (remove unsupported parameters).
  4. Confirm project/location values are correct and the model is GA/available to your project.

Example fix

// before
// vertex.getClient({ modelId: 'gemini-not-real', location: 'us-middle1' })
// after
// vertex.getClient({ modelId: 'gemini-1.5-pro', location: 'us-central1' })
Defensive patterns

Strategy: validation

Validate before calling

function validateVertexRequest({ modelId, location }) {
  const errors = [];
  if (!modelId || !/^[a-z0-9.-]+$/.test(modelId)) errors.push('modelId missing or malformed');
  if (!location || !/^[a-z]+-[a-z]+\d+$/.test(location)) errors.push('location must look like us-central1');
  if (errors.length) throw new Error('Invalid Vertex config: ' + errors.join('; '));
}

Try / catch

try {
  await vertex.getClient(...);
} catch (e) {
  if (/Invalid request:/.test(e.message)) {
    console.error('Vertex 400:', e.message); // read Google's field-level reason
    // fix model/region/payload before retrying; do not blind-retry
    return null;
  }
  throw e;
}

Prevention

When it happens

Trigger: getClient()/API call receives error.response.status === 400 from the Vertex AI endpoint; handleError maps it to VertexConfigError.

Common situations: 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.

Related errors


AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29). Data as JSON: /api/errors/3a10d83c5152c4b2. Report an issue: GitHub.