router-for-me/CLIProxyAPI · error
antigravity userinfo: response missing email
Error message
antigravity userinfo: response missing email
What it means
Userinfo responded 2xx with decodable JSON, but the email field was absent or whitespace-only. The account may not have an email exposed to this OAuth client (scope not granted), or the response schema put the address under a different key.
Source
Thrown at internal/auth/antigravity/auth.go:221
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
}
// FetchProjectID retrieves the project ID for the authenticated user via loadCodeAssist
func (o *AntigravityAuth) FetchProjectID(ctx context.Context, accessToken string) (string, error) {
userAgent := o.shortUserAgent()
loadReqBody := map[string]any{
"metadata": antigravityLoadCodeAssistMetadata(),
}
rawBody, errMarshal := json.Marshal(loadReqBody)
if errMarshal != nil {
return "", fmt.Errorf("marshal request body: %w", errMarshal)
}
endpointURL := fmt.Sprintf("%s/%s:loadCodeAssist", APIEndpoint, APIVersion)
req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpointURL, strings.NewReader(string(rawBody)))View on GitHub (pinned to 78f0c4079e)
Solutions
- Add the email scope to the Antigravity authorization request and re-authorize
- Inspect the decoded userinfo JSON for where the address actually appears (e.g. emails array) and map accordingly
- Fall back to another identifier if email is unavailable for that account type
Defensive patterns
Strategy: validation
Try / catch
if strings.Contains(err.Error(), "response missing email") {
// re-authorize with email scope or use an alternate account identifier
} Prevention
- Request the email scope during authorization
- Map alternate fields (e.g. emails array) when accounts hide the primary email
When it happens
Trigger: Authorization request lacked the email scope, so Google omits the email field; Workspace accounts with hidden emails; schema change renaming the field.
Common situations: Authorization URL built without email scope; consent screen skipping email grant; service-account-style flows that have no primary email.
Related errors
- antigravity token exchange: create request: %w
- antigravity token exchange: execute request: %w
- antigravity token exchange: read response: %w
- antigravity token exchange: request failed: status %d
- antigravity token exchange: request failed: status %d: %s
AI-assisted analysis of router-for-me/CLIProxyAPI@78f0c4079e (2026-08-15).
Data as JSON: /api/errors/4a7562f4dab4fae9.
Report an issue: GitHub.