git-ecosystem/git-credential-manager · info · Trace2Exception
User cancelled dialog.
Error message
User cancelled dialog.
What it means
DeviceCommand's ExecuteAsync shows the device-code dialog (displaying the code and URL) and if the user closes the window without confirming (WindowResult false), it throws this Trace2Exception since the device flow cannot proceed without user confirmation.
Solutions
- Re-run the login and confirm the device-code dialog, then complete entry at https://github.com/login/device.
- Use a PAT instead: 'git-credential-manager github login --pat'.
- On machines without a browser, authenticate elsewhere and transfer credentials, or use GCM_INTERACTIVE=Never with stored credentials.
- In scripts, catch the exception and fall back to token-based authentication.
Defensive patterns
Strategy: try-catch
Try / catch
try
{
int result = await deviceCommand.ExecuteAsync(input, output);
}
catch (Exception ex) when (ex.Message == "User cancelled dialog.")
{
// fall back to PAT login or abort the operation gracefully
} Prevention
- Confirm the device-code dialog and enter the code before it expires
- Use --pat login on machines where the dialog is likely to be dismissed
- Ensure a browser is reachable so the flow can be completed
- Catch the exception in scripts to avoid cascading failures
When it happens
Trigger: Running the device-code login command (DeviceCommand.ExecuteAsync) and cancelling/closing the device-code dialog before confirming.
Common situations: Users closing the 'enter this code at github.com/login/device' dialog because they changed their mind or were on a machine without browser access; headless environments where the dialog is dismissed automatically.
Related errors
- User canceled device code authentication
- User cancelled dialog.
- User cancelled dialog.
- User cancelled dialog.
- User cancelled dialog.
AI-assisted analysis of git-ecosystem/git-credential-manager@e8ce762cd0 (2026-09-11).
Data as JSON: /api/errors/a1cf541ddc8442cf.
Report an issue: GitHub.
Appendix: source
Thrown at src/GitHub/UI/Commands/DeviceCommand.cs:36
var url = new Option<string>("--url", "Verification URL.");
AddOption(url);
this.SetHandler(ExecuteAsync, code, url);
}
private async Task<int> ExecuteAsync(string code, string url)
{
var viewModel = new DeviceCodeViewModel(Context.SessionManager)
{
UserCode = code,
VerificationUrl = url,
};
await ShowAsync(viewModel, CancellationToken.None);
if (!viewModel.WindowResult)
{
throw new Trace2Exception(Context.Trace2, "User cancelled dialog.");
}
return 0;
}
protected abstract Task ShowAsync(DeviceCodeViewModel viewModel, CancellationToken ct);
}
}
View on GitHub (pinned to e8ce762cd0)