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

User cancelled dialog.

Error message

User cancelled dialog.

What it means

SelectAccountCommand's ExecuteAsync shows an account-selection dialog after listing stored GitHub accounts. If the window is closed without picking an account (WindowResult false), it throws a plain Exception with this message because no account can be written to the result.

Solutions

  1. Re-run the command and explicitly select an account, then confirm the dialog.
  2. Remove unwanted stored accounts ('git-credential-manager github logout') so the picker is not needed.
  3. Specify the account/username up front in the git URL (e.g. https://username@github.com/owner/repo.git) to bypass the picker.
  4. Catch the exception in tooling and treat it as 'no account chosen'.
Defensive patterns

Strategy: try-catch

Validate before calling

var accounts = run("git-credential-manager github list");
if (accounts.Split('\n', StringSplitOptions.RemoveEmptyEntries).Length > 1)
{
    // multiple accounts: embed the desired user in the remote URL to skip the picker
}

Try / catch

try
{
    await selectAccountCommand.ExecuteAsync(input, output);
}
catch (Exception ex) when (ex.Message == "User cancelled dialog.")
{
    // no account chosen; fall back to username-in-URL or re-prompt
}

Prevention

When it happens

Trigger: Running the select-account command when multiple GitHub accounts are stored and the user cancels or closes the account picker dialog without selecting one.

Common situations: Users with several GitHub accounts dismissing the picker; automation that cannot render the dialog; users wanting to add a new account but cancelling instead.

Related errors


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

Appendix: source

Thrown at src/GitHub/UI/Commands/SelectAccountCommand.cs:41

            this.SetHandler(ExecuteAsync, url, noHelp);
        }

        private async Task<int> ExecuteAsync(string enterpriseUrl, bool noHelp)
        {
            // Read accounts from standard input
            IList<string> accounts = ReadAccounts();

            var viewModel = new SelectAccountViewModel(Context.SessionManager, accounts)
            {
                EnterpriseUrl = enterpriseUrl,
                ShowHelpLink = !noHelp
            };

            await ShowAsync(viewModel, CancellationToken.None);

            if (!viewModel.WindowResult)
            {
                throw new Exception("User cancelled dialog.");
            }

            WriteResult(new Dictionary<string, string>
            {
                ["account"] = viewModel.SelectedAccount?.UserName
            });

            return 0;
        }

        private IList<string> ReadAccounts()
        {
            var accounts = new List<string>();

            string line;
            while (!string.IsNullOrWhiteSpace(line = Context.Streams.In.ReadLine()))
            {
                accounts.Add(line.Trim());

View on GitHub (pinned to e8ce762cd0)