git-ecosystem/git-credential-manager · info · Trace2Exception

User cancelled dialog.

Error message

User cancelled dialog.

What it means

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.

Solutions

  1. Re-run the git operation and complete the dialog by choosing an authentication mode.
  2. 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.
  3. If the dialog closes on its own, check terminal/GUI availability (terminal prompts, WSL display issues) before retrying.
Defensive patterns

Strategy: try-catch

Try / catch

try { var cred = await gcm.GetCredentialAsync(input); } catch (Trace2Exception ex) when (ex.Message == "User cancelled dialog.") { /* treat as cancellation, not failure: exit gracefully */ }

Prevention

When it happens

Trigger: Showing the Bitbucket authentication-mode dialog and the user clicks cancel/closes the window, or dismisses it without choosing OAuth, Basic, or another mode.

Common situations: 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.

Related errors


AI-assisted analysis of git-ecosystem/git-credential-manager@e8ce762cd0 (2026-09-11). Data as JSON: /api/errors/aaa5231de6a8d16d. Report an issue: GitHub.

Appendix: source

Thrown at src/Atlassian.Bitbucket/UI/Commands/CredentialsCommand.cs:47

            this.SetHandler(ExecuteAsync, url, userName, oauth, basic);
        }

        private async Task<int> ExecuteAsync(Uri url, string userName, bool showOAuth, bool showBasic)
        {
            var viewModel = new CredentialsViewModel(Context.SessionManager)
            {
                Url = url,
                UserName = userName,
                ShowOAuth = showOAuth,
                ShowBasic = showBasic
            };

            await ShowAsync(viewModel, CancellationToken.None);

            if (!viewModel.WindowResult || viewModel.SelectedMode == AuthenticationModes.None)
            {
                throw new Trace2Exception(Context.Trace2, "User cancelled dialog.");
            }

            switch (viewModel.SelectedMode)
            {
                case AuthenticationModes.OAuth:
                    WriteResult(new Dictionary<string, string>
                    {
                        ["mode"] = "oauth"
                    });
                    break;

                case AuthenticationModes.Basic:
                    WriteResult(new Dictionary<string, string>
                    {
                        ["mode"] = "basic",
                        ["username"] = viewModel.UserName,
                        ["password"] = viewModel.Password,
                    });

View on GitHub (pinned to e8ce762cd0)