git-ecosystem/git-credential-manager · info · OperationCanceledException
User cancelled dialog.
Error message
User cancelled dialog.
What it means
Thrown when the user closes or cancels a GUI credential dialog, indicated by the dialog's WindowViewModel.WindowResult being false. It is GCM's way of surfacing a deliberate user abort as an OperationCanceledException.
Solutions
- Re-run the operation and complete the dialog to proceed
- Make the credential dialog non-interactive by pre-supplying credentials via configuration or a credential helper
- Catch OperationCanceledException in the caller and treat it as an expected user abort rather than a failure
Example fix
// before
catch (Exception ex) { log.Error(ex); }
// after
catch (OperationCanceledException) { log.Info("User cancelled authentication."); }
catch (Exception ex) { log.Error(ex); } Defensive patterns
Strategy: try-catch
Try / catch
try { /* auth flow */ }
catch (OperationCanceledException) { Console.Error.WriteLine("Authentication cancelled by user."); return ExitCode.Failure; } Prevention
- Don't leave auth dialogs unattended in automation; pre-supply credentials
- Treat OperationCanceledException separately from other exceptions
When it happens
Trigger: A modal authentication window (shown by a derived AuthenticationBase implementation) is dismissed via Cancel or the X button so viewModel.WindowResult is false when ThrowIfWindowCancelled checks it.
Common situations: User clicks Cancel in the sign-in dialog; user closes the window without entering credentials; automation accidentally dismisses the dialog.
Related errors
- User cancelled dialog.
- User cancelled dialog.
- Cannot show prompt because GUI prompts have been disabled.
- User cancelled dialog.
- User cancelled dialog.
AI-assisted analysis of git-ecosystem/git-credential-manager@e8ce762cd0 (2026-09-11).
Data as JSON: /api/errors/47d8f8ff8416443e.
Report an issue: GitHub.
Appendix: source
Thrown at src/Core/Authentication/AuthenticationBase.cs:122
Context.Trace.WriteLine($"{Constants.EnvironmentVariables.GitTerminalPrompts} is 0; GUI prompts have been disabled.");
throw new Trace2InvalidOperationException(Context.Trace2, "Cannot show prompt because GUI prompts have been disabled.");
}
}
protected void ThrowIfTerminalPromptsDisabled()
{
if (!Context.Settings.IsTerminalPromptsEnabled)
{
Context.Trace.WriteLine($"{Constants.EnvironmentVariables.GitTerminalPrompts} is 0; terminal prompts have been disabled.");
throw new Trace2InvalidOperationException(Context.Trace2, "Cannot prompt because terminal prompts have been disabled.");
}
}
protected void ThrowIfWindowCancelled(WindowViewModel viewModel)
{
if (!viewModel.WindowResult)
{
throw new OperationCanceledException("User cancelled dialog.");
}
}
protected IntPtr GetParentWindowHandle()
{
if (int.TryParse(Context.Settings.ParentWindowId, out int id))
{
return new IntPtr(id);
}
return IntPtr.Zero;
}
protected bool TryFindHelperCommand(string envar, string configName, string defaultValue, out string command, out string args)
{
command = null;
args = null;
View on GitHub (pinned to e8ce762cd0)