{"record":{"id":"ee2365f01dddc375","repo":"git-ecosystem/git-credential-manager","slug":"missing-password-in-response-ee2365","errorCode":null,"errorMessage":"Missing 'password' in response","messagePattern":"Missing 'password' in response","errorType":"exception","errorClass":"Trace2Exception","httpStatus":null,"severity":"error","filePath":"src/GitLab/GitLabAuthentication.cs","lineNumber":249,"sourceCode":"                    {\n                        // Username is optional for PATs\n                    }\n\n                    return new AuthenticationPromptResult(\n                        AuthenticationModes.Pat, new GitCredential(patUserName, pat));\n\n                case \"browser\":\n                    return new AuthenticationPromptResult(AuthenticationModes.Browser);\n\n                case \"basic\":\n                    if (!resultDict.TryGetValue(\"username\", out userName))\n                    {\n                        throw new Trace2Exception(Context.Trace2, \"Missing 'username' in response\");\n                    }\n\n                    if (!resultDict.TryGetValue(\"password\", out string password))\n                    {\n                        throw new Trace2Exception(Context.Trace2, \"Missing 'password' in response\");\n                    }\n\n                    return new AuthenticationPromptResult(\n                        AuthenticationModes.Basic, new GitCredential(userName, password));\n\n                default:\n                    throw new Trace2Exception(Context.Trace2,\n                        $\"Unknown mode value in response '{responseMode}'\");\n            }\n        }\n\n        public async Task<OAuth2TokenResult> GetOAuthTokenViaBrowserAsync(Uri targetUri, IEnumerable<string> scopes)\n        {\n            ThrowIfUserInteractionDisabled();\n\n            var oauthClient = new GitLabOAuth2Client(HttpClient, Context.Settings, targetUri, Context.Trace2);\n\n            // We require a desktop session to launch the user's default web browser","sourceCodeStart":231,"sourceCodeEnd":267,"githubUrl":"https://github.com/git-ecosystem/git-credential-manager/blob/e8ce762cd04b4100ae637b5fbf39ef9d0a96561e/src/GitLab/GitLabAuthentication.cs#L231-L267","documentation":"Thrown in GetAuthenticationViaHelperAsync when the helper response declares `mode=basic` but no 'password' key is present. Together with the username, the password is mandatory to build the AuthenticationModes.Basic GitCredential.","triggerScenarios":"Helper emits `mode=basic` and `username=...` but omits `password=`; helper aborted its password prompt but still reported basic mode.","commonSituations":"Helpers that read the secret from ssh-agent/keychain which returned nothing; password special characters mangled by quoting so the line was dropped; scripts written for a different credential protocol.","solutions":["Ensure the helper always emits `password=` with the credential when reporting mode=basic.","Quote/escape special characters in the password when constructing helper output.","Fall back to mode=pat if the helper cannot obtain a password reliably."],"exampleFix":"// before\necho \"mode=basic\"\necho \"username=$USER\"\n# password never printed\n// after\necho \"mode=basic\"\necho \"username=$USER\"\necho \"password=$PASS\"","handlingStrategy":"validation","validationCode":"// Assert password present before printing basic-mode response\n[ -n \"$PASS\" ] || { echo \"password missing\" >&2; exit 1; }","typeGuard":null,"tryCatchPattern":"try {\n  var result = await auth.GetAuthenticationAsync(...);\n} catch (Trace2Exception ex) when (ex.Message.Contains(\"Missing 'password' in response\")) {\n  // re-prompt or switch to PAT flow\n}","preventionTips":["Quote passwords when emitting helper output to survive special characters","Confirm secret-store lookups (keychain, ssh-agent) succeed before declaring basic mode","Fail early in the helper with a clear stderr message instead of emitting a partial response"],"tags":["gitlab","credential-helper","basic-auth"],"backgroundTag":"missing-credentials","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"}