router-for-me/CLIProxyAPI · error
antigravity userinfo: read response: %w
Error message
antigravity userinfo: read response: %w
What it means
Userinfo returned a non-2xx status and reading its (8 KiB-limited) body failed. The response started but the body read was interrupted — connection reset, truncation, or context cancellation between headers and body.
Source
Thrown at internal/auth/antigravity/auth.go:207
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)
}
var info userInfo
if errDecode := json.NewDecoder(resp.Body).Decode(&info); errDecode != nil {
return "", fmt.Errorf("antigravity userinfo: decode response: %w", errDecode)
}
email := strings.TrimSpace(info.Email)
if email == "" {
return "", fmt.Errorf("antigravity userinfo: response missing email")
}
return email, nil
}
View on GitHub (pinned to 78f0c4079e)
Solutions
- Increase the context/httpClient timeout to cover full body reads
- Retry the idempotent userinfo request
- Include resp.StatusCode in logs to know what the server was reporting even without the body
Defensive patterns
Strategy: retry
Try / catch
if strings.Contains(err.Error(), "userinfo: read response") {
// body interrupted; retry the idempotent GET
} Prevention
- Set timeouts covering full body reads
- Retry userinfo on truncation — it is read-only
When it happens
Trigger: Google responds 401/403 then resets the connection; context deadline hits while streaming the error body; intermediary truncates the response.
Common situations: Tight timeouts that cover only the header round-trip; unstable networks during auth.
Related errors
- antigravity token exchange: read response: %w
- antigravity token exchange: create request: %w
- antigravity token exchange: execute request: %w
- antigravity token exchange: decode response: %w
- antigravity userinfo: execute request: %w
AI-assisted analysis of router-for-me/CLIProxyAPI@78f0c4079e (2026-08-15).
Data as JSON: /api/errors/c522ba10e5eedb20.
Report an issue: GitHub.