{"record":{"id":"76c90cd7e1f98600","repo":"juanfont/headscale","slug":"s-unexpected-status-code-d","errorCode":null,"errorMessage":"%s unexpected status code %d","messagePattern":"(.+?) unexpected status code (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"integration/scenario.go","lineNumber":1211,"sourceCode":"\tbodyBytes, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn \"\", nil, fmt.Errorf(\"%s reading response body: %w\", hostname, err)\n\t}\n\n\tbody := string(bodyBytes)\n\n\tvar redirectURL *url.URL\n\tif resp.StatusCode >= http.StatusMultipleChoices && resp.StatusCode < http.StatusBadRequest {\n\t\tredirectURL, err = resp.Location()\n\t\tif err != nil {\n\t\t\treturn body, nil, fmt.Errorf(\"%s resolving redirect location: %w\", hostname, err)\n\t\t}\n\t}\n\n\tif followRedirects && resp.StatusCode != http.StatusOK {\n\t\tlog.Printf(\"body: %s\", body)\n\n\t\treturn body, redirectURL, fmt.Errorf(\"%s unexpected status code %d\", hostname, resp.StatusCode) //nolint:err113\n\t}\n\n\tif resp.StatusCode >= http.StatusBadRequest {\n\t\tlog.Printf(\"body: %s\", body)\n\n\t\treturn body, redirectURL, fmt.Errorf(\"%s unexpected status code %d\", hostname, resp.StatusCode) //nolint:err113\n\t}\n\n\tif hc.Jar != nil {\n\t\tif jar, ok := hc.Jar.(*debugJar); ok {\n\t\t\tjar.Dump(os.Stdout)\n\t\t} else {\n\t\t\tlog.Printf(\"cookies: %+v\", hc.Jar.Cookies(loginURL))\n\t\t}\n\t}\n\n\t// The OIDC registration flow now renders a confirmation interstitial\n\t// (POST form) instead of completing immediately. Detect the form and","sourceCodeStart":1193,"sourceCodeEnd":1229,"githubUrl":"https://github.com/juanfont/headscale/blob/565fd254d06c4c7f9a8cad1714a43445c79ba420/integration/scenario.go#L1193-L1229","documentation":"Error \"%s unexpected status code %d\" thrown in juanfont/headscale.","triggerScenarios":"Thrown at integration/scenario.go:1211 when the library encounters an invalid state.","commonSituations":"The OIDC login flow returned an unexpected HTTP status. Check the provider's response and the headscale OIDC configuration.","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."],"exampleFix":"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.","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"565fd254d06c4c7f9a8cad1714a43445c79ba420","analyzedAt":"2026-08-15T13:12:30.133Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}