{"record":{"id":"3e735853a97936bb","repo":"git-ecosystem/git-credential-manager","slug":"missing-password-request-argument","errorCode":null,"errorMessage":"Missing 'password' request argument","messagePattern":"Missing 'password' request argument","errorType":"exception","errorClass":"Trace2InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Core/Commands/StoreCommand.cs","lineNumber":34,"sourceCode":"\n        protected override Task ExecuteInternalAsync(GitRequest request, IHostProvider provider)\n        {\n            return provider.StoreCredentialAsync(request);\n        }\n\n        protected override void EnsureMinimumRequest(GitRequest request)\n        {\n            base.EnsureMinimumRequest(request);\n\n            // An empty string username/password are valid inputs, so only check for `null` (not provided)\n            if (request.UserName is null)\n            {\n                throw new Trace2InvalidOperationException(Context.Trace2, \"Missing 'username' request argument\");\n            }\n\n            if (request.Password is null)\n            {\n                throw new Trace2InvalidOperationException(Context.Trace2, \"Missing 'password' request argument\");\n            }\n        }\n    }\n}\n","sourceCodeStart":16,"sourceCodeEnd":39,"githubUrl":"https://github.com/git-ecosystem/git-credential-manager/blob/e8ce762cd04b4100ae637b5fbf39ef9d0a96561e/src/Core/Commands/StoreCommand.cs#L16-L39","documentation":"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.","triggerScenarios":"Calling the store command where the credential input lacks a `password=` line, so request.Password is null after base and username validation passed.","commonSituations":"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.","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."],"exampleFix":"// before (programmatic store request missing password)\nvar request = new GitRequest { Protocol = \"https\", Host = \"github.com\", UserName = \"octocat\" };\n\n// after\nvar request = new GitRequest { Protocol = \"https\", Host = \"github.com\", UserName = \"octocat\", Password = \"ghp_...\" };","handlingStrategy":"validation","validationCode":"if (request.Password is null)\n    throw new ArgumentException(\"password is required for store (empty string is allowed)\");","typeGuard":"bool HasPassword(GitRequest r) => r.Password is not null;","tryCatchPattern":"try\n{\n    await storeCommand.ExecuteAsync(input);\n}\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"'password'\"))\n{\n    // ensure the token-generation step produced a secret, then retry\n}","preventionTips":["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."],"tags":["git","credential-store","missing-argument","request-validation"],"backgroundTag":"missing-required-argument","analyzedSha":"e8ce762cd04b4100ae637b5fbf39ef9d0a96561e","analyzedAt":"2026-09-11T17:15:08.753Z","contentChangedAt":"2026-09-11T17:15:08.753Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}