googleapis/mcp-toolbox · error

failed to execute pipeline request: %w

Error message

failed to execute pipeline request: %w

What it means

This error wraps a failure from httpClient.Do(req) in ExecuteMQL — the executePipeline HTTP POST to Firestore never completed. Causes are transport-level: DNS failure, unreachable host, TLS handshake error, timeouts, or context cancellation mid-flight. No HTTP response was received, so no status code is available.

Source

Thrown at internal/sources/firestore/firestore.go:926

		}
		bodyBytes, err = json.Marshal(payload)
		if err != nil {
			return nil, fmt.Errorf("failed to marshal pipeline payload: %w", err)
		}
	}

	req, err := http.NewRequestWithContext(ctx, http.MethodPost, url, bytes.NewReader(bodyBytes))
	if err != nil {
		return nil, fmt.Errorf("failed to create HTTP request: %w", err)
	}
	req.Header.Set("Content-Type", "application/json")
	req.Header.Set("User-Agent", userAgent)
	req.Header.Set("x-goog-request-params", fmt.Sprintf("project_id=%s&database_id=%s", s.GetProjectId(), s.GetDatabaseId()))
	req.Header.Set("x-goog-firestore-api-requester", "querydata")

	resp, err := httpClient.Do(req)
	if err != nil {
		return nil, fmt.Errorf("failed to execute pipeline request: %w", err)
	}
	defer resp.Body.Close()

	respBody, err := io.ReadAll(resp.Body)
	if err != nil {
		return nil, fmt.Errorf("failed to read response body: %w", err)
	}

	if resp.StatusCode < 200 || resp.StatusCode >= 300 {
		return nil, fmt.Errorf("executePipeline API error (status %d): %s", resp.StatusCode, string(respBody))
	}

	var result any
	if err := json.Unmarshal(respBody, &result); err != nil {
		return string(respBody), nil
	}

	return result, nil

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Check basic connectivity to firestore.googleapis.com (DNS, firewall, proxy settings) from the host
  2. Increase the HTTP source Timeout if long-running pipelines are being cut off
  3. Retry with backoff for transient network errors; check ctx cancellation to distinguish caller-induced aborts from true network faults

Example fix

// before
ctx := context.Background()
res, err := src.ExecuteMQL(ctx, pipeline) // hangs/fails on slow networks
// after
ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
defer cancel()
res, err := src.ExecuteMQL(ctx, pipeline)
Defensive patterns

Strategy: retry

Validate before calling

// preflight connectivity check
conn, err := net.DialTimeout("tcp", "firestore.googleapis.com:443", 5*time.Second)
if err != nil { log.Printf("no egress to Firestore API: %v", err) } else { conn.Close() }

Try / catch

var res string
var err error
for i := 0; i < 3; i++ {
    res, err = src.ExecuteMQL(ctx, pipeline)
    if err == nil || !isNetworkErr(err) || ctx.Err() != nil { break }
    time.Sleep(time.Duration(1<<i) * 100 * time.Millisecond)
}

Prevention

When it happens

Trigger: httpClient.Do(req) returns a non-nil error during the POST to the Firestore executePipeline endpoint: network outage, DNS resolution failure, TLS failure, client timeout exceeded, or the request context being cancelled while the request was in flight.

Common situations: No internet/VPC-egress route to firestore.googleapis.com; corporate proxy or firewall blocking the call; the HTTP source Timeout being shorter than the pipeline execution; caller cancelling ctx (e.g. HTTP handler deadline) mid-request; transient Google API outages.

Related errors


AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05). Data as JSON: /api/errors/7ce356e300db59a1. Report an issue: GitHub.