git-ecosystem/git-credential-manager · warning · Trace2Exception
User cancelled dialog.
Error message
User cancelled dialog.
What it means
CredentialsCommand (the GUI credential dialog) shows a window and inspects viewModel.WindowResult after it closes. If the user dismissed/cancelled the dialog, WindowResult is false and a Trace2Exception('User cancelled dialog.') is thrown so the cancellation is recorded in Git's trace2 output rather than treated as a success with no data.
Solutions
- Complete the dialog and click OK/Submit instead of cancelling.
- If cancellation is intentional, let the host handle it — git treats the helper's failure as 'no credential' and may fall back to another helper.
- Avoid repeated prompts by storing credentials after first successful auth (GCM's cache/OS stores) or use a PAT in the remote URL/credential store.
- In automation, prevent the dialog entirely: GCM_INTERACTIVE=never or GUI=never so a non-interactive path is used.
Example fix
// before (CI invoking GUI helper) git fetch // dialog appears, auto-cancelled -> Trace2Exception // after set GCM_INTERACTIVE=never set GCM_GUI=never
Defensive patterns
Strategy: try-catch
Validate before calling
// Don't open the dialog if the session can't interact with it: bool guiUsable = Environment.UserInteractive && !Console.IsOutputRedirected;
Try / catch
try { await credentialsCommand.ExecuteAsync(...); }
catch (Trace2Exception ex) when (ex.Message == "User cancelled dialog.")
{ // treat as 'no credential provided', not a hard failure
return Result.Cancelled(); } Prevention
- Never invoke the GUI helper from headless/CI environments; set GCM_INTERACTIVE=never.
- Communicate to users that closing the dialog cancels authentication.
- Pre-provision credentials (PAT in wincredman/cache) so the dialog rarely appears.
- Handle the exception in calling code as a benign cancellation signal and fall back to another credential helper.
When it happens
Trigger: Showing the credential dialog via ExecuteAsync (git credential fill routing to the GUI helper) and the user clicks Cancel, closes the window, or presses Escape, making WindowResult false.
Common situations: Users hitting Escape or the X button on the credential prompt; dialogs killed by focus/automation tools; headless-with-GUI setups where the dialog cannot be interacted with and gets dismissed.
Related errors
- User cancelled dialog.
- Cannot show prompt because GUI prompts have been disabled.
- Failed to search for credentials
- Failed to store credentials
- -1
AI-assisted analysis of git-ecosystem/git-credential-manager@e8ce762cd0 (2026-09-11).
Data as JSON: /api/errors/d7ee01af5f201d2c.
Report an issue: GitHub.
Appendix: source
Thrown at src/Core/UI/Commands/CredentialsCommand.cs:53
viewModel.Title = title;
}
viewModel.Description = !string.IsNullOrWhiteSpace(resource)
? $"Enter your credentials for '{resource}'"
: "Enter your credentials";
if (!string.IsNullOrWhiteSpace(userName))
{
viewModel.UserName = userName;
}
viewModel.ShowProductHeader = !noLogo;
await ShowAsync(viewModel, CancellationToken.None);
if (!viewModel.WindowResult)
{
throw new Trace2Exception(Context.Trace2, "User cancelled dialog.");
}
WriteResult(
new Dictionary<string, string>
{
["username"] = viewModel.UserName,
["password"] = viewModel.Password
}
);
return 0;
}
protected abstract Task ShowAsync(CredentialsViewModel viewModel, CancellationToken ct);
}
}
View on GitHub (pinned to e8ce762cd0)