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

User cancelled dialog.

Error message

User cancelled dialog.

What it means

The GitHub 'credentials' UI command (choose authentication mode dialog) shows a window and expects the user to confirm. If the dialog is closed without confirming (WindowResult false), ExecuteAsync throws this Trace2Exception because no selection can be written back to the calling git process.

Solutions

  1. Re-run the git operation and complete the dialog (select an auth mode and click confirm) instead of cancelling.
  2. Use a non-interactive path: provide a PAT up front or set GCM_INTERACTIVE=Never to avoid the dialog.
  3. Pre-select the auth mode via configuration (e.g. credential.githubAuthModes) so the dialog is not required.
  4. Handle the exception in calling code and treat it as the user declining authentication.
Defensive patterns

Strategy: try-catch

Validate before calling

if (Environment.UserInteractive == false)
{
    // don't launch the dialog; configure auth mode via credential.githubAuthModes instead
    return;
}

Try / catch

try
{
    int result = await new CredentialsCommand(context).ExecuteAsync(input, output);
}
catch (Exception ex) when (ex.Message == "User cancelled dialog.")
{
    // treat as user declining; exit gracefully or configure auth non-interactively
}

Prevention

When it happens

Trigger: Running 'git-credential-manager github' style command (CredentialsCommand.ExecuteAsync) and closing/cancelling the authentication-mode selection dialog instead of choosing an option and clicking confirm.

Common situations: Users pressing the X or Escape on the GitHub auth-mode dialog during a git push; GUI prompts appearing unexpectedly in semi-headless setups and being dismissed; automation closing dialogs.

Related errors


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

Appendix: source

Thrown at src/GitHub/UI/Commands/CredentialsCommand.cs:66

                ShowTokenLogin   = all || pat,
                ShowBasicLogin   = all || basic,
            };

            if (!GitHubHostProvider.IsGitHubDotCom(enterpriseUrl))
            {
                viewModel.EnterpriseUrl = enterpriseUrl;
            }

            if (!string.IsNullOrWhiteSpace(userName))
            {
                viewModel.UserName = userName;
            }

            await ShowAsync(viewModel, CancellationToken.None);

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

            var result = new Dictionary<string, string>();

            switch (viewModel.SelectedMode)
            {
                case AuthenticationModes.Basic:
                    result["mode"] = "basic";
                    result["username"] = viewModel.UserName;
                    result["password"] = viewModel.Password;
                    break;

                case AuthenticationModes.Browser:
                    result["mode"] = "browser";
                    break;

                case AuthenticationModes.Device:
                    result["mode"] = "device";

View on GitHub (pinned to e8ce762cd0)