netbirdio/netbird · error

doing request failed with error

Error message

doing request failed with error: %v

What it means

The HTTP POST to the OAuth device-authorization endpoint failed at the transport level (d.HTTPClient.Do returned an error: DNS, connection, TLS, or timeout). RequestAuthInfo cannot obtain a device code, so the device login flow aborts with the transport cause embedded.

Solutions

  1. Retry the request with backoff
  2. Verify network connectivity and the device auth endpoint URL
  3. Check TLS/proxy configuration on the host
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at client/internal/auth/device_flow.go:155 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/087f555bff894174. Report an issue: GitHub.

Appendix: source

Thrown at client/internal/auth/device_flow.go:155

	d.providerConfig.LoginHint = hint
}

// RequestAuthInfo requests a device code login flow information from Hosted
func (d *DeviceAuthorizationFlow) RequestAuthInfo(ctx context.Context) (AuthFlowInfo, error) {
	form := url.Values{}
	form.Add("client_id", d.providerConfig.ClientID)
	form.Add("audience", d.providerConfig.Audience)
	form.Add("scope", d.providerConfig.Scope)
	req, err := http.NewRequest("POST", d.providerConfig.DeviceAuthEndpoint,
		strings.NewReader(form.Encode()))
	if err != nil {
		return AuthFlowInfo{}, fmt.Errorf("creating request failed with error: %v", err)
	}
	req.Header.Add("Content-Type", "application/x-www-form-urlencoded")

	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)
	}

View on GitHub (pinned to 93e97f4bf1)