router-for-me/CLIProxyAPI · error

antigravity userinfo: execute request: %w

Error message

antigravity userinfo: execute request: %w

What it means

The GET to the userinfo endpoint failed at the transport level (httpClient.Do). The wrapped *url.Error identifies the real cause: DNS failure, connection refused, TLS error, timeout, or context cancellation after the request started.

Source

Thrown at internal/auth/antigravity/auth.go:196

	return &token, nil
}

// FetchUserInfo retrieves user email from Google
func (o *AntigravityAuth) FetchUserInfo(ctx context.Context, accessToken string) (string, error) {
	accessToken = strings.TrimSpace(accessToken)
	if accessToken == "" {
		return "", fmt.Errorf("antigravity userinfo: missing access token")
	}
	req, err := http.NewRequestWithContext(ctx, http.MethodGet, UserInfoEndpoint, nil)
	if err != nil {
		return "", fmt.Errorf("antigravity userinfo: create request: %w", err)
	}
	req.Header.Set("Authorization", "Bearer "+accessToken)
	req.Header.Set("User-Agent", o.shortUserAgent())

	resp, errDo := o.httpClient.Do(req)
	if errDo != nil {
		return "", fmt.Errorf("antigravity userinfo: execute request: %w", errDo)
	}
	defer func() {
		if errClose := resp.Body.Close(); errClose != nil {
			log.Errorf("antigravity userinfo: close body error: %v", errClose)
		}
	}()

	if resp.StatusCode < http.StatusOK || resp.StatusCode >= http.StatusMultipleChoices {
		bodyBytes, errRead := io.ReadAll(io.LimitReader(resp.Body, 8<<10))
		if errRead != nil {
			return "", fmt.Errorf("antigravity userinfo: read response: %w", errRead)
		}
		body := strings.TrimSpace(string(bodyBytes))
		if body == "" {
			return "", fmt.Errorf("antigravity userinfo: request failed: status %d", resp.StatusCode)
		}
		return "", fmt.Errorf("antigravity userinfo: request failed: status %d: %s", resp.StatusCode, body)
	}

View on GitHub (pinned to 78f0c4079e)

Solutions

  1. Unwrap the error to distinguish DNS/TLS/timeout and test reachability with curl from the same host
  2. Trust the proxy CA or configure the proxy on the http.Client
  3. Retry — userinfo is a read-only idempotent call, unlike the one-shot code exchange
Defensive patterns

Strategy: retry

Try / catch

var netErr net.Error
if errors.As(err, &netErr) && netErr.Timeout() {
	// idempotent read — safe to retry with backoff
}

Prevention

When it happens

Trigger: No egress to the Google userinfo host; TLS interception with untrusted CA; context deadline exceeded mid-request; proxy blocking the endpoint.

Common situations: Sandboxed/CI environments without network; corporate MITM proxies; transient drops during the auth sequence.

Related errors


AI-assisted analysis of router-for-me/CLIProxyAPI@78f0c4079e (2026-08-15). Data as JSON: /api/errors/4bb7b6ede4df58f1. Report an issue: GitHub.