juanfont/headscale · error
%s unexpected status code %d
Error message
%s unexpected status code %d
What it means
Error "%s unexpected status code %d" thrown in juanfont/headscale.
Source
Thrown at integration/scenario.go:1211
bodyBytes, err := io.ReadAll(resp.Body)
if err != nil {
return "", nil, fmt.Errorf("%s reading response body: %w", hostname, err)
}
body := string(bodyBytes)
var redirectURL *url.URL
if resp.StatusCode >= http.StatusMultipleChoices && resp.StatusCode < http.StatusBadRequest {
redirectURL, err = resp.Location()
if err != nil {
return body, nil, fmt.Errorf("%s resolving redirect location: %w", hostname, err)
}
}
if followRedirects && resp.StatusCode != http.StatusOK {
log.Printf("body: %s", body)
return body, redirectURL, fmt.Errorf("%s unexpected status code %d", hostname, resp.StatusCode) //nolint:err113
}
if resp.StatusCode >= http.StatusBadRequest {
log.Printf("body: %s", body)
return body, redirectURL, fmt.Errorf("%s unexpected status code %d", hostname, resp.StatusCode) //nolint:err113
}
if hc.Jar != nil {
if jar, ok := hc.Jar.(*debugJar); ok {
jar.Dump(os.Stdout)
} else {
log.Printf("cookies: %+v", hc.Jar.Cookies(loginURL))
}
}
// The OIDC registration flow now renders a confirmation interstitial
// (POST form) instead of completing immediately. Detect the form andView on GitHub (pinned to 565fd254d0)
Solutions
- Inspect the wrapped error for the underlying cause and correct the failing condition (unexpected status code); retry the operation after fixing the input, configuration, or environment.
Example fix
Inspect the wrapped error for the underlying cause and correct the failing condition (unexpected status code); retry the operation after fixing the input, configuration, or environment.
When it happens
Trigger: Thrown at integration/scenario.go:1211 when the library encounters an invalid state.
Common situations: The OIDC login flow returned an unexpected HTTP status. Check the provider's response and the headscale OIDC configuration.
AI-assisted analysis of juanfont/headscale@565fd254d0 (2026-08-15).
Data as JSON: /api/errors/76c90cd7e1f98600.
Report an issue: GitHub.