{"record":{"id":"aaa5231de6a8d16d","repo":"git-ecosystem/git-credential-manager","slug":"user-cancelled-dialog","errorCode":null,"errorMessage":"User cancelled dialog.","messagePattern":"User cancelled dialog\\.","errorType":"exception","errorClass":"Trace2Exception","httpStatus":null,"severity":"info","filePath":"src/Atlassian.Bitbucket/UI/Commands/CredentialsCommand.cs","lineNumber":47,"sourceCode":"\n            this.SetHandler(ExecuteAsync, url, userName, oauth, basic);\n        }\n\n        private async Task<int> ExecuteAsync(Uri url, string userName, bool showOAuth, bool showBasic)\n        {\n            var viewModel = new CredentialsViewModel(Context.SessionManager)\n            {\n                Url = url,\n                UserName = userName,\n                ShowOAuth = showOAuth,\n                ShowBasic = showBasic\n            };\n\n            await ShowAsync(viewModel, CancellationToken.None);\n\n            if (!viewModel.WindowResult || viewModel.SelectedMode == AuthenticationModes.None)\n            {\n                throw new Trace2Exception(Context.Trace2, \"User cancelled dialog.\");\n            }\n\n            switch (viewModel.SelectedMode)\n            {\n                case AuthenticationModes.OAuth:\n                    WriteResult(new Dictionary<string, string>\n                    {\n                        [\"mode\"] = \"oauth\"\n                    });\n                    break;\n\n                case AuthenticationModes.Basic:\n                    WriteResult(new Dictionary<string, string>\n                    {\n                        [\"mode\"] = \"basic\",\n                        [\"username\"] = viewModel.UserName,\n                        [\"password\"] = viewModel.Password,\n                    });","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/git-ecosystem/git-credential-manager/blob/e8ce762cd04b4100ae637b5fbf39ef9d0a96561e/src/Atlassian.Bitbucket/UI/Commands/CredentialsCommand.cs#L29-L65","documentation":"In CredentialsCommand.ExecuteAsync (Bitbucket DC authentication dialog), if the user closes the window (WindowResult false) or leaves SelectedMode as AuthenticationModes.None, GCM treats this as a cancellation and throws a Trace2Exception so the failure is reported to Git's trace2 telemetry instead of silently returning nothing.","triggerScenarios":"Showing the Bitbucket authentication-mode dialog and the user clicks cancel/closes the window, or dismisses it without choosing OAuth, Basic, or another mode.","commonSituations":"Users aborting the login prompt during git pull/push; GUI dialog failing to render choices so SelectedMode stays None; automation environments where the dialog is closed programmatically; users hitting Esc.","solutions":["Re-run the git operation and complete the dialog by choosing an authentication mode.","If no interaction is desired, pre-configure credentials (e.g. credential.store or PAT via git credential approve) or set GCM_INTERACTIVE=never to fail fast with a clearer error.","If the dialog closes on its own, check terminal/GUI availability (terminal prompts, WSL display issues) before retrying."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { var cred = await gcm.GetCredentialAsync(input); } catch (Trace2Exception ex) when (ex.Message == \"User cancelled dialog.\") { /* treat as cancellation, not failure: exit gracefully */ }","preventionTips":["Do not treat user cancellation as a system error in calling scripts","Pre-provision credentials when running headless to avoid dialogs entirely","Verify GUI availability (WSL display, terminal) so the dialog renders with all options"],"tags":["bitbucket","ui","user-cancelled","git-credential-manager"],"backgroundTag":"user-cancelled-dialog","analyzedSha":"e8ce762cd04b4100ae637b5fbf39ef9d0a96561e","analyzedAt":"2026-09-11T17:15:08.753Z","contentChangedAt":"2026-09-11T17:15:08.753Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}