{"id":"8229dc91c27b85ec","repo":"docker/cli","slug":"failed-to-start-device-code-flow-login","errorCode":null,"errorMessage":"failed to start device code flow login","messagePattern":"failed to start device code flow login","errorType":"exception","errorClass":"ErrDeviceLoginStartFail","httpStatus":null,"severity":"error","filePath":"internal/oauth/manager/manager.go","lineNumber":76,"sourceCode":"\t\tbrowser.Stderr = io.Discard\n\t\topenBrowser = browser.OpenURL\n\t}\n\n\treturn &OAuthManager{\n\t\tclientID: options.ClientID,\n\t\taudience: options.Audience,\n\t\ttenant:   options.Tenant,\n\t\tstore:    options.Store,\n\t\tapi: api.API{\n\t\t\tTenantURL: \"https://\" + options.Tenant,\n\t\t\tClientID:  options.ClientID,\n\t\t\tScopes:    scopes,\n\t\t},\n\t\topenBrowser: openBrowser,\n\t}\n}\n\nvar ErrDeviceLoginStartFail = errors.New(\"failed to start device code flow login\")\n\n// LoginDevice launches the device authentication flow with the tenant,\n// printing instructions to the provided writer and attempting to open the\n// browser for the user to authenticate.\n// After the user completes the browser login, LoginDevice uses the retrieved\n// tokens to create a Hub PAT which is returned to the caller.\n// The retrieved tokens are stored in the credentials store (under a separate\n// key), and the refresh token is concatenated with the client ID.\nfunc (m *OAuthManager) LoginDevice(ctx context.Context, w io.Writer) (*types.AuthConfig, error) {\n\tstate, err := m.api.GetDeviceCode(ctx, m.audience)\n\tif err != nil {\n\t\tlogrus.Debugf(\"failed to start device code login: %v\", err)\n\t\treturn nil, ErrDeviceLoginStartFail\n\t}\n\n\tif state.UserCode == \"\" {\n\t\tlogrus.Debugf(\"failed to start device code login: missing user code\")\n\t\treturn nil, ErrDeviceLoginStartFail","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/internal/oauth/manager/manager.go#L58-L94","documentation":"Error \"failed to start device code flow login\" thrown in docker/cli.","triggerScenarios":"Thrown at internal/oauth/manager/manager.go:76 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"e9452d6e785f6e365712b9d71bd7517591773c86","analyzedAt":"2026-08-01T07:09:22.474Z","schemaVersion":2}