{"record":{"id":"e4cbf0aa802a2537","repo":"netbirdio/netbird","slug":"getting-device-authorization-flow-info-failed-with","errorCode":null,"errorMessage":"getting device authorization flow info failed with error: %v","messagePattern":"getting device authorization flow info failed with error: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/internal/auth/oauth.go","lineNumber":126,"sourceCode":"func authenticateWithDeviceCodeFlow(ctx context.Context, config *profilemanager.Config, hint string) (OAuthFlow, error) {\n\tauthClient, err := NewAuth(ctx, config.PrivateKey, config.ManagementURL, config)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create auth client: %v\", err)\n\t}\n\tdefer authClient.Close()\n\n\tdeviceFlowInfo, err := authClient.getDeviceFlow(authClient.client)\n\tif err != nil {\n\t\tswitch s, ok := gstatus.FromError(err); {\n\t\tcase ok && s.Code() == codes.NotFound:\n\t\t\treturn nil, fmt.Errorf(\"no SSO provider returned from management. \" +\n\t\t\t\t\"Please proceed with setting up this device using setup keys \" +\n\t\t\t\t\"https://docs.netbird.io/how-to/register-machines-using-setup-keys\")\n\t\tcase ok && s.Code() == codes.Unimplemented:\n\t\t\treturn nil, fmt.Errorf(\"the management server, %s, does not support SSO providers, \"+\n\t\t\t\t\"please update your server or use Setup Keys to login\", config.ManagementURL)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"getting device authorization flow info failed with error: %v\", err)\n\t\t}\n\t}\n\n\tif hint != \"\" {\n\t\tdeviceFlowInfo.SetLoginHint(hint)\n\t}\n\n\treturn deviceFlowInfo, nil\n}\n","sourceCodeStart":108,"sourceCodeEnd":136,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/client/internal/auth/oauth.go#L108-L136","documentation":"Returned by authenticateWithDeviceCodeFlow when the getDeviceFlow RPC fails with any gRPC error other than NotFound or Unimplemented (client/internal/auth/oauth.go:125-126). This is the catch-all branch: transport failures, DeadlineExceeded, PermissionDenied, Internal, or Unavailable from management. The underlying gstatus text is embedded via %v, so the wrapped code and message are the real diagnostic.","triggerScenarios":"Connection dropped mid-RPC (Unavailable), management handler panic or DB error (Internal), auth token expired for the host key session (Unauthenticated), or request timeout (DeadlineExceeded) while management fetches IdP configuration.","commonSituations":"Management server crash-looping or restarting; management database unreachable so the IdP lookup errors; load balancer idle-timeouting the gRPC stream; host key session expired after long offline periods.","solutions":["Read the embedded gRPC code in the message (e.g. 'rpc error: code = Unavailable') to pick the right track","Check management server health and logs at the timestamp of the login attempt","Retry netbird up - Unavailable/DeadlineExceeded are often transient during management restarts","If Unauthenticated, re-register the host (setup key) since the stored credentials are no longer accepted"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"// Narrow the catch-all branch by extracting the gRPC code\nfunc isTransientGRPC(err error) bool {\n\ts, ok := gstatus.FromError(err)\n\tif !ok {\n\t\treturn false\n\t}\n\treturn s.Code() == codes.Unavailable || s.Code() == codes.DeadlineExceeded\n}","tryCatchPattern":"if err != nil {\n\tif s, ok := gstatus.FromError(errors.Unwrap(err)); ok {\n\t\tswitch s.Code() {\n\t\tcase codes.Unavailable, codes.DeadlineExceeded:\n\t\t\t// transient: retry the login flow\n\t\tcase codes.Unauthenticated:\n\t\t\t// host key session rejected: re-register with a setup key\n\t\tdefault:\n\t\t\t// management-side error: check server logs\n\t\t}\n\t}\n}","preventionTips":["Parse the embedded gRPC code before choosing a remedy - the default branch is a catch-all","Retry only Unavailable/DeadlineExceeded; treat Internal/Unauthenticated as management-side","Correlate login failures with management logs by timestamp"],"tags":["grpc","management","sso","network","error-handling"],"backgroundTag":null,"analyzedSha":"93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c","analyzedAt":"2026-08-16T03:09:19.136Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}