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

Missing 'password' in response

Error message

Missing 'password' in response

What it means

Same failure mode as the missing 'username' case but for the 'password' key: the credential helper responded without a password, so no GitCredential can be returned. The helper is not following Git's credential output protocol.

Solutions

  1. Run the helper manually and confirm it prints both username= and password= lines
  2. Fix the helper's password retrieval (keychain/decrypt) logic
  3. Check helper logs/trace output (GCM_TRACE) for helper-side errors
  4. Switch to a maintained helper that emits complete credential responses

Example fix

# before (helper prints only username)
echo "username=$USER"
# after
echo "username=$USER"
echo "password=$PASS"
Defensive patterns

Strategy: validation

Validate before calling

var output = RunHelper(command, args);
if (!output.Contains("password=")) throw new InvalidOperationException("Helper does not emit password=");

Try / catch

try { /* get creds via helper */ }
catch (Trace2Exception ex) when (ex.Message.Contains("Missing 'password'")) { /* fix helper secret retrieval */ }

Prevention

When it happens

Trigger: GetCredentialsViaHelperAsync successfully parsed a 'username' from the helper response, but resultDict.TryGetValue("password", out password) failed because the helper printed no password=... line.

Common situations: Helper authenticates the user but fails to obtain/decrypt the secret; helper emits username only (e.g. OAuth-style helper where the code path errored); partially implemented custom helper; helper errored internally but still exited 0.

Related errors


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

Appendix: source

Thrown at src/Core/Authentication/BasicAuthentication.cs:120

            {
                promptArgs.AppendFormat(" --resource {0}", QuoteCmdArg(resource));
            }

            if (!string.IsNullOrWhiteSpace(userName))
            {
                promptArgs.AppendFormat(" --username {0}", QuoteCmdArg(userName));
            }

            IDictionary<string, string> resultDict = await InvokeHelperAsync(command, promptArgs.ToString(), null);

            if (!resultDict.TryGetValue("username", out userName))
            {
                throw new Trace2Exception(Context.Trace2, "Missing 'username' in response");
            }

            if (!resultDict.TryGetValue("password", out string password))
            {
                throw new Trace2Exception(Context.Trace2, "Missing 'password' in response");
            }

            return new GitCredential(userName, password);
        }

        private bool TryFindHelperCommand(out string command, out string args)
        {
            return TryFindHelperCommand(
                Constants.EnvironmentVariables.GcmUiHelper,
                Constants.GitConfiguration.Credential.UiHelper,
                Constants.DefaultUiHelper,
                out command,
                out args);
        }
    }
}

View on GitHub (pinned to e8ce762cd0)