eyaltoledano/claude-task-master · error · Error

Vertex AI ${operation} failed: ${error.message}

Error message

Vertex AI ${operation} failed: ${error.message}

What it means

Catch-all path in handleError: when the thrown value is not an HTTP response error (no error.response), it is rethrown as a plain Error reading 'Vertex AI <operation> failed: <message>'. This covers network failures, timeouts, DNS errors, and any non-HTTP exception during the Vertex call.

Source

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

		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. Log the original error (the message is preserved) to determine network vs code cause.
  2. Check connectivity to aiplatform.googleapis.com (curl/ping, proxy settings).
  3. Increase the client timeout if long generations are being cut off.
  4. Wrap calls in retry logic with backoff for transient network errors.

Example fix

// before: undiagnosed 'Vertex AI generateText failed: socket hang up'
// after: configure/verify network access
// curl -I https://us-central1-aiplatform.googleapis.com
// export HTTPS_PROXY=http://corporate-proxy:8080 # if behind proxy
Defensive patterns

Strategy: retry

Validate before calling

async function canReachVertex(location = 'us-central1') {
  try {
    const res = await fetch(`https://${location}-aiplatform.googleapis.com/`, { signal: AbortSignal.timeout(5000) });
    return true; // any HTTP response means DNS/TLS/network OK
  } catch { return false; }
}

Type guard

function isNetworkError(e) {
  return e instanceof Error && !('response' in e) && /network|socket|timeout|ECONN|ENOTFOUND|aborted/i.test(e.message);
}

Try / catch

try {
  return await vertexCall();
} catch (e) {
  if (isNetworkError(e)) {
    await sleep(backoff(attempt++));
    return vertexCall(); // retry transient network failures
  }
  throw e;
}

Prevention

When it happens

Trigger: getClient()/API call throws without an error.response property — e.g. fetch/axios network error, connection reset, timeout, request aborted, or a coding error inside the request path.

Common situations: No internet/VPN blocking googleapis.com, DNS resolution failure, request timeout due to slow model responses, proxy misconfiguration, or a bug throwing a non-HTTP error.

Related errors


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