git-ecosystem/git-credential-manager · error · Trace2InvalidOperationException
Missing 'password' request argument
Error message
Missing 'password' request argument
What it means
StoreCommand.EnsureMinimumRequest requires a 'password' argument when storing credentials. As with username, only null (not provided) is rejected — an empty string is a valid value. Without a password/secret there is nothing to store.
Solutions
- Add a `password=<secret>` line (PAT/OAuth token) to the credential input before invoking store.
- In code, set request.Password explicitly (empty string allowed, null is not).
- If the credential truly has no secret, pass `password=` with an empty value instead of omitting the line.
- Verify the token-producing step (e.g. OAuth flow) succeeded and emitted the secret.
Example fix
// before (programmatic store request missing password)
var request = new GitRequest { Protocol = "https", Host = "github.com", UserName = "octocat" };
// after
var request = new GitRequest { Protocol = "https", Host = "github.com", UserName = "octocat", Password = "ghp_..." }; Defensive patterns
Strategy: validation
Validate before calling
if (request.Password is null)
throw new ArgumentException("password is required for store (empty string is allowed)"); Type guard
bool HasPassword(GitRequest r) => r.Password is not null;
Try / catch
try
{
await storeCommand.ExecuteAsync(input);
}
catch (InvalidOperationException ex) when (ex.Message.Contains("'password'"))
{
// ensure the token-generation step produced a secret, then retry
} Prevention
- Confirm token issuance succeeded before invoking store.
- Include password= in every store payload; avoid dropping empty lines in pipes.
- Distinguish null vs empty string in credential plumbing.
- Never silently swallow failed upstream steps feeding the store command.
When it happens
Trigger: Calling the store command where the credential input lacks a `password=` line, so request.Password is null after base and username validation passed.
Common situations: CI scripts that pipe only account/URL data; token-generation failures upstream that drop the password field; manual store invocations for testing; integrations that erase/patch credential records with partial data.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- Missing 'username' request argument
- Missing 'protocol' request argument
- Missing 'host' request argument
- Invalid 'protocol' request argument (cannot be empty)
- Invalid 'host' request argument (cannot be empty)
AI-assisted analysis of git-ecosystem/git-credential-manager@e8ce762cd0 (2026-09-11).
Data as JSON: /api/errors/3e735853a97936bb.
Report an issue: GitHub.
Appendix: source
Thrown at src/Core/Commands/StoreCommand.cs:34
protected override Task ExecuteInternalAsync(GitRequest request, IHostProvider provider)
{
return provider.StoreCredentialAsync(request);
}
protected override void EnsureMinimumRequest(GitRequest request)
{
base.EnsureMinimumRequest(request);
// An empty string username/password are valid inputs, so only check for `null` (not provided)
if (request.UserName is null)
{
throw new Trace2InvalidOperationException(Context.Trace2, "Missing 'username' request argument");
}
if (request.Password is null)
{
throw new Trace2InvalidOperationException(Context.Trace2, "Missing 'password' request argument");
}
}
}
}
View on GitHub (pinned to e8ce762cd0)