git-ecosystem/git-credential-manager · error · InvalidOperationException
No available interaction modes.
Error message
No available interaction modes.
What it means
Thrown from GetTokenForUserInteractiveAsync when InteractionMode.Auto is requested (or defaulted) but none of the interactive mechanisms — embedded webview, system webview, or device code flow — are available on the current platform/configuration. The library cannot perform user interactive authentication at all, so it fails fast with this InvalidOperationException.
Solutions
- Verify which modes are available with IsEmbeddedWebViewAvailable/IsSystemWebViewAvailable/IsDeviceCodeAvailable before requesting Auto mode.
- Explicitly pass InteractionMode.DeviceCode and ensure device code flow is supported (network access to the device authorization endpoint).
- Run in an environment with a browser or desktop session (GUI available) so a webview mode can be used.
- Pre-authenticate on a machine with a browser and copy credentials/tokens to the headless environment.
Example fix
// before var token = await auth.GetTokenForUserAsync(scopes); // Auto -> throws on headless box // after var token = await auth.GetTokenForUserAsync(scopes, Interaction: InteractionMode.DeviceCode);
Defensive patterns
Strategy: fallback
Validate before calling
bool anyMode = IsEmbeddedWebViewAvailable() || IsSystemWebViewAvailable() || IsDeviceCodeAvailable();
if (!anyMode) throw new InvalidOperationException("No interactive authentication available in this environment."); Try / catch
try
{
token = await auth.GetTokenForUserAsync(scopes);
}
catch (InvalidOperationException ex) when (ex.Message == "No available interaction modes.")
{
// fall back to device code flow or fail with a clear message
token = await auth.GetTokenForUserAsync(scopes, Interaction: InteractionMode.DeviceCode);
} Prevention
- Detect headless environments (no DISPLAY/WAYLAND, SSH sessions) before requesting interactive auth.
- Default to DeviceCode mode on servers and CI.
- Pre-authenticate interactively on a machine with a browser and transfer credentials.
When it happens
Trigger: Calling GetTokenForUserAsync (which resolves to GetTokenForUserInteractiveAsync) with InteractionMode.Auto on a headless environment (SSH session, CI runner, container) where no webview is available and the device code endpoint/flow is unavailable or disabled.
Common situations: Running GCM or a tool using this library on a headless Linux server, inside Docker, over SSH without a browser, or on a stripped-down platform where MSAL reports no supported broker/webview and device code flow is unavailable.
Understand the failure class
Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.
Related errors
- Browser authentication requires a desktop session
- Must specify at least one AuthenticationModes
- Unknown authentication mode
- At least one AuthenticationModes must be supplied
- Missing username in response
AI-assisted analysis of git-ecosystem/git-credential-manager@e8ce762cd0 (2026-09-11).
Data as JSON: /api/errors/878ffb7bc0a6fa26.
Report an issue: GitHub.
Appendix: source
Thrown at src/Core/Authentication/Entra/EntraAuthentication.PublicClient.cs:300
Context.Trace.WriteLine($"Interaction mode overriden to '{mode}'.");
interactionMode = mode;
}
switch (interactionMode)
{
// Try to use the most appropriate interaction mode available
case InteractionMode.Auto:
Context.Trace.WriteLine("Resolving interactive mode auto...");
if (IsEmbeddedWebViewAvailable())
goto case InteractionMode.EmbeddedWebView;
if (IsSystemWebViewAvailable())
goto case InteractionMode.SystemWebView;
if (IsDeviceCodeAvailable())
goto case InteractionMode.DeviceCode;
throw new InvalidOperationException("No available interaction modes.");
case InteractionMode.EmbeddedWebView:
Context.Trace.WriteLine("Performing interactive authentication via embedded webview...");
return await app.AcquireTokenInteractive(scopes)
.WithUseEmbeddedWebView(true)
.WithEmbeddedWebViewOptions(GetEmbeddedWebViewOptions())
.ExecuteAsync(ct);
case InteractionMode.SystemWebView:
Context.Trace.WriteLine("Performing interactive authentication via system webview...");
Context.Console.WriteInfo("opening browser to complete authentication...");
return await app.AcquireTokenInteractive(scopes)
.WithUseEmbeddedWebView(false)
.WithSystemWebViewOptions(GetSystemWebViewOptions())
.ExecuteAsync(ct);
case InteractionMode.DeviceCode:
Context.Trace.WriteLine("Performing interactive authentication via device code...");View on GitHub (pinned to e8ce762cd0)