git-ecosystem/git-credential-manager · error · Trace2Exception
Interactive logon for
Error message
Interactive logon for '{0}' failed. What it means
After GCM performs an interactive (browser/GUI) GitHub logon to obtain a Personal Access Token, if the token is null or the interactive flow did not produce a usable credential, GeneratePersonalAccessTokenAsync throws this Trace2Exception formatted with the target URI. It signals that the interactive authentication attempt completed without yielding a token.
Solutions
- Retry the interactive logon and ensure any requested OAuth authorization (SSO/org access) is completed in the browser.
- Fall back to a PAT: create one at github.com/settings/tokens and store it via 'git-credential-manager github login --pat' or 'git credential approve'.
- Check organization/SAML policy: authorize GCM's OAuth app for the organization or enable SSO for your token.
- Inspect trace logs (GCM_TRACE=1) to see why the token was null after logon.
Example fix
// before (interactive logon returned no token) git-credential-manager github login // after (use an explicit PAT) git-credential-manager github login --pat // paste a PAT created at https://github.com/settings/tokens
Defensive patterns
Strategy: fallback
Try / catch
try
{
var cred = await provider.GenerateCredentialAsync(targetUri, modes);
}
catch (Exception ex) when (ex.Message.Contains("Interactive logon for") && ex.Message.Contains("failed"))
{
// prompt for an explicit PAT and retry with it
} Prevention
- Ensure the OAuth app/organization authorizations (SAML SSO) are granted before logging in
- Keep a valid PAT as fallback for interactive logon failures
- Check GCM_TRACE=1 logs after any failed interactive logon
- Complete the browser authentication fully before closing the window
When it happens
Trigger: Calling GitHubHostProvider.GenerateCredentialAsync which routes to GeneratePersonalAccessTokenAsync; the interactive logon (via GitHubAuthentication) returns no token (user completed the dialog path but token was null/empty) for the given targetUri.
Common situations: GitHub login dialogs that report success but fail to mint a PAT (OAuth app restrictions, SAML SSO not authorized, org policies); network failure right after authentication; enterprise/GHE instances rejecting the token request.
Related errors
- Missing 'pat' in response
- Missing 'mode' in response
- Missing 'username' in response
- Missing 'password' in response
- Unknown mode value in response
AI-assisted analysis of git-ecosystem/git-credential-manager@e8ce762cd0 (2026-09-11).
Data as JSON: /api/errors/cad2d38923478029.
Report an issue: GitHub.
Appendix: source
Thrown at src/GitHub/GitHubHostProvider.cs:399
if (result.Type == GitHubAuthenticationResultType.Success)
{
_context.Trace.WriteLine($"Token acquisition for '{targetUri}' succeeded.");
token = result.Token;
}
}
if (token != null)
{
// Resolve the GitHub user handle
GitHubUserInfo userInfo = await _gitHubApi.GetUserInfoAsync(targetUri, token);
return new GitCredential(userInfo.Login, token);
}
var format = "Interactive logon for '{0}' failed.";
var message = string.Format(format, targetUri);
throw new Trace2Exception(_context.Trace2, message, format);
}
internal async Task<AuthenticationModes> GetSupportedAuthenticationModesAsync(Uri targetUri)
{
// Check for an explicit override for supported authentication modes
if (_context.Settings.TryGetSetting(
GitHubConstants.EnvironmentVariables.AuthenticationModes,
Constants.GitConfiguration.Credential.SectionName, GitHubConstants.GitConfiguration.Credential.AuthenticationModes,
out string authModesStr))
{
if (Enum.TryParse(authModesStr, true, out AuthenticationModes authModes) && authModes != AuthenticationModes.None)
{
_context.Trace.WriteLine($"Supported authentication modes override present: {authModes}");
return authModes;
}
else
{
_context.Trace.WriteLine($"Invalid value for supported authentication modes override setting: '{authModesStr}'");View on GitHub (pinned to e8ce762cd0)