{"record":{"id":"29e0a0e2f4f2d92a","repo":"netbirdio/netbird","slug":"request-device-code-returned-status-d-error-s","errorCode":null,"errorMessage":"request device code returned status %d error: %s","messagePattern":"request device code returned status (.+?) error: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/internal/auth/device_flow.go","lineNumber":165,"sourceCode":"\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 != \"\" {\n\t\tdeviceCode.VerificationURIComplete = appendLoginHint(deviceCode.VerificationURIComplete, d.providerConfig.LoginHint)\n\t\tif deviceCode.VerificationURI != \"\" {\n\t\t\tdeviceCode.VerificationURI = appendLoginHint(deviceCode.VerificationURI, d.providerConfig.LoginHint)\n\t\t}","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/client/internal/auth/device_flow.go#L147-L183","documentation":"Error \"request device code returned status %d error: %s\" thrown in netbirdio/netbird.","triggerScenarios":"Thrown at client/internal/auth/device_flow.go:165 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c","analyzedAt":"2026-08-16T03:09:19.136Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}