git-ecosystem/git-credential-manager · error · Trace2Exception

Missing use_default_account in response

Error message

Missing use_default_account in response

What it means

Raised in UseDefaultAccountAsync when a GUI helper command (invoked with the 'default-account' subcommand) returns a response dictionary that does not contain a usable 'use_default_account' key. The library treats a helper response missing this field as a contract violation and throws Trace2Exception instead of guessing the user's answer.

Solutions

  1. Update the credential helper/GUI application to a version that implements the default-account protocol and returns 'use_default_account'.
  2. Verify the helper command configuration (TryFindHelperCommand resolution) points at the correct bundled helper.
  3. Disable the helper or GUI prompts (Context.Settings / IsGuiPromptsEnabled) so the built-in dialog or confirmation prompt is used instead.
  4. Capture trace2 output to inspect the raw helper response and fix the helper's output format.
Defensive patterns

Strategy: try-catch

Try / catch

try
{
    useDefault = await auth.UseDefaultAccountAsync(userName, ct);
}
catch (Trace2Exception ex) when (ex.Message.Contains("use_default_account"))
{
    // helper is non-compliant; fall back to GUI dialog / prompt path
    useDefault = false;
}

Prevention

When it happens

Trigger: A configured credential helper GUI process is invoked via TryFindHelperCommand and InvokeHelperAsync but its JSON/stdout response lacks the 'use_default_account' entry, or the entry is null/whitespace.

Common situations: Out-of-date or third-party helper executable that predates the 'default-account' protocol, a helper crashing or returning partial output, or a misconfigured helper command path pointing at the wrong binary.

Related errors


AI-assisted analysis of git-ecosystem/git-credential-manager@e8ce762cd0 (2026-09-11). Data as JSON: /api/errors/d33c6ac2cd0aeda6. Report an issue: GitHub.

Appendix: source

Thrown at src/Core/Authentication/Entra/EntraAuthentication.PublicClient.cs:346

    {
        ThrowIfUserInteractionDisabled();

        if (Context.SessionManager.IsDesktopSession && Context.Settings.IsGuiPromptsEnabled)
        {
            if (TryFindHelperCommand(out string command, out string args))
            {
                var sb = new StringBuilder(args);
                sb.Append("default-account");
                sb.AppendFormat(" --username {0}", QuoteCmdArg(userName));

                IDictionary<string, string> result = await InvokeHelperAsync(command, sb.ToString());

                if (result.TryGetValue("use_default_account", out string str) && !string.IsNullOrWhiteSpace(str))
                {
                    return str.ToBooleanyOrDefault(false);
                }

                throw new Trace2Exception(Context.Trace2, "Missing use_default_account in response");
            }

            var viewModel = new DefaultAccountViewModel(Context.SessionManager)
            {
                UserName = userName
            };

            await AvaloniaUi.ShowViewAsync<DefaultAccountView>(viewModel, GetParentWindowHandle(), ct);

            ThrowIfWindowCancelled(viewModel);

            return viewModel.UseDefaultAccount;
        }

        var prompt = new ConfirmationPrompt($"Continue with current account ({userName})?");
        return await prompt.ShowAsync(Context.Console, ct);
    }

View on GitHub (pinned to e8ce762cd0)