{"record":{"id":"55eda6af9453ee22","repo":"netbirdio/netbird","slug":"reading-body-failed-with-error-v","errorCode":null,"errorMessage":"reading body failed with error: %v","messagePattern":"reading body failed with error: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/internal/auth/device_flow.go","lineNumber":161,"sourceCode":"\tform.Add(\"client_id\", d.providerConfig.ClientID)\n\tform.Add(\"audience\", d.providerConfig.Audience)\n\tform.Add(\"scope\", d.providerConfig.Scope)\n\treq, err := http.NewRequest(\"POST\", d.providerConfig.DeviceAuthEndpoint,\n\t\tstrings.NewReader(form.Encode()))\n\tif err != nil {\n\t\treturn AuthFlowInfo{}, fmt.Errorf(\"creating request failed with error: %v\", err)\n\t}\n\treq.Header.Add(\"Content-Type\", \"application/x-www-form-urlencoded\")\n\n\tres, err := d.HTTPClient.Do(req)\n\tif err != nil {\n\t\treturn AuthFlowInfo{}, fmt.Errorf(\"doing request failed with error: %v\", err)\n\t}\n\n\tdefer res.Body.Close()\n\tbody, err := io.ReadAll(res.Body)\n\tif err != nil {\n\t\treturn AuthFlowInfo{}, fmt.Errorf(\"reading body failed with error: %v\", err)\n\t}\n\n\tif res.StatusCode != 200 {\n\t\treturn AuthFlowInfo{}, fmt.Errorf(\"request device code returned status %d error: %s\", res.StatusCode, string(body))\n\t}\n\n\tdeviceCode := AuthFlowInfo{}\n\terr = json.Unmarshal(body, &deviceCode)\n\tif err != nil {\n\t\treturn AuthFlowInfo{}, fmt.Errorf(\"unmarshaling response failed with error: %v\", err)\n\t}\n\n\t// Fallback to the verification_uri if the IdP doesn't support verification_uri_complete\n\tif deviceCode.VerificationURIComplete == \"\" {\n\t\tdeviceCode.VerificationURIComplete = deviceCode.VerificationURI\n\t}\n\n\tif d.providerConfig.LoginHint != \"\" {","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/client/internal/auth/device_flow.go#L143-L179","documentation":"Reading the response body from the device-authorization endpoint failed after a successful HTTP call (io.ReadAll error). Without the body the AuthFlowInfo (device code, verification URI, interval) cannot be decoded, so RequestAuthInfo fails and the device flow cannot proceed.","triggerScenarios":"Thrown at client/internal/auth/device_flow.go:161 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the request","Check for intermediary proxies truncating responses","Verify IdP endpoint stability"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c","analyzedAt":"2026-08-16T03:09:19.136Z","contentChangedAt":"2026-08-16T03:09:19.136Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}