sipeed/picoclaw · error
reading userinfo response
Error message
reading userinfo response: %w
What it means
Context wrapper in fetchGoogleUserEmail around io.ReadAll of the userinfo response body: the HTTP request to googleapis.com succeeded (status not yet checked), but streaming the body failed mid-read — typically a dropped connection or client timeout (10s). The access token was accepted far enough to get a response; the email just could not be read.
Solutions
- Retry the request — mid-body connection drops are usually transient
- Increase the 10s client timeout on slow links
- Check network stability / proxy behavior for long-lived responses
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at cmd/picoclaw/internal/auth/helpers.go:253 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of sipeed/picoclaw@49183d7e8d (2026-08-15).
Data as JSON: /api/errors/06752feba4cd7010.
Report an issue: GitHub.
Appendix: source
Thrown at cmd/picoclaw/internal/auth/helpers.go:253
}
func fetchGoogleUserEmail(accessToken string) (string, error) {
req, err := http.NewRequest("GET", "https://www.googleapis.com/oauth2/v2/userinfo", nil)
if err != nil {
return "", err
}
req.Header.Set("Authorization", "Bearer "+accessToken)
client := &http.Client{Timeout: 10 * time.Second}
resp, err := client.Do(req)
if err != nil {
return "", err
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
return "", fmt.Errorf("reading userinfo response: %w", err)
}
if resp.StatusCode != http.StatusOK {
return "", fmt.Errorf("userinfo request failed: %s", string(body))
}
var userInfo struct {
Email string `json:"email"`
}
if err := json.Unmarshal(body, &userInfo); err != nil {
return "", err
}
return userInfo.Email, nil
}
func authLoginPasteToken(provider string) error {
cred, err := auth.LoginPasteToken(provider, os.Stdin)
if err != nil {
return fmt.Errorf("login failed: %w", err)View on GitHub (pinned to 49183d7e8d)