netbirdio/netbird · error
unmarshaling response failed with error
Error message
unmarshaling response failed with error: %v
What it means
Fires in RequestAuthInfo when json.Unmarshal cannot parse the device-authorization endpoint's 200 response into AuthFlowInfo. The IdP returned a 200 but the body is not valid JSON or lacks the expected fields (DeviceCode, UserCode, VerificationURI, etc.), indicating a non-conforming provider, an HTML error/interstitial page behind a 200, or a changed API shape.
Solutions
- Log the raw body to see what the IdP actually returned (HTML login page, proxy block page, or malformed JSON)
- Confirm the endpoint is the correct device authorization URL from the IdP's .well-known/openid-configuration
- Check for an intercepting proxy or captive portal returning non-JSON content with a 200 status
- Update field mappings or provider handling if the IdP changed its response schema
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at client/internal/auth/device_flow.go:171 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of netbirdio/netbird@93e97f4bf1 (2026-08-16).
Data as JSON: /api/errors/067fa29c949f0fd2.
Report an issue: GitHub.
Appendix: source
Thrown at client/internal/auth/device_flow.go:171
res, err := d.HTTPClient.Do(req)
if err != nil {
return AuthFlowInfo{}, fmt.Errorf("doing request failed with error: %v", err)
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
return AuthFlowInfo{}, fmt.Errorf("reading body failed with error: %v", err)
}
if res.StatusCode != 200 {
return AuthFlowInfo{}, fmt.Errorf("request device code returned status %d error: %s", res.StatusCode, string(body))
}
deviceCode := AuthFlowInfo{}
err = json.Unmarshal(body, &deviceCode)
if err != nil {
return AuthFlowInfo{}, fmt.Errorf("unmarshaling response failed with error: %v", err)
}
// Fallback to the verification_uri if the IdP doesn't support verification_uri_complete
if deviceCode.VerificationURIComplete == "" {
deviceCode.VerificationURIComplete = deviceCode.VerificationURI
}
if d.providerConfig.LoginHint != "" {
deviceCode.VerificationURIComplete = appendLoginHint(deviceCode.VerificationURIComplete, d.providerConfig.LoginHint)
if deviceCode.VerificationURI != "" {
deviceCode.VerificationURI = appendLoginHint(deviceCode.VerificationURI, d.providerConfig.LoginHint)
}
}
return deviceCode, err
}
func appendLoginHint(uri, loginHint string) string {View on GitHub (pinned to 93e97f4bf1)