AlexxIT/go2rtc · error
wyze: failed to parse login response
Error message
wyze: failed to parse login response: %w
What it means
The Wyze login response had no API error but its body could not be parsed into loginResponse, meaning an unexpected/malformed JSON payload was returned. Wraps the unmarshal error; raised in Login (also via LoginWithCaptcha).
Solutions
- Retry the login request
- Update loginResponse fields to match the current Wyze API
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at pkg/wyze/cloud.go:133 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
AI-assisted analysis of AlexxIT/go2rtc@c245815e75 (2026-09-07).
Data as JSON: /api/errors/41c02915cffda10b.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/wyze/cloud.go:133
if err != nil {
return err
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
return err
}
var errResp apiError
_ = json.Unmarshal(body, &errResp)
if errResp.hasError() {
return fmt.Errorf("wyze: login failed (code %s): %s", errResp.code(), errResp.message())
}
var result loginResponse
if err := json.Unmarshal(body, &result); err != nil {
return fmt.Errorf("wyze: failed to parse login response: %w", err)
}
if len(result.MFAOptions) > 0 {
return &AuthError{
Message: "MFA required",
NeedsMFA: true,
MFAType: strings.Join(result.MFAOptions, ","),
}
}
if result.AccessToken == "" {
return errors.New("wyze: no access token in response")
}
c.accessToken = result.AccessToken
return nil
}View on GitHub (pinned to c245815e75)