{"record":{"id":"1f5d3faa9d55046a","repo":"git-ecosystem/git-credential-manager","slug":"missing-username-in-response-1f5d3f","errorCode":null,"errorMessage":"Missing 'username' in response","messagePattern":"Missing 'username' in response","errorType":"exception","errorClass":"Trace2Exception","httpStatus":null,"severity":"error","filePath":"src/Core/Authentication/BasicAuthentication.cs","lineNumber":115,"sourceCode":"        {\n            var promptArgs = new StringBuilder(args);\n            promptArgs.Append(\"basic\");\n\n            if (!string.IsNullOrWhiteSpace(resource))\n            {\n                promptArgs.AppendFormat(\" --resource {0}\", QuoteCmdArg(resource));\n            }\n\n            if (!string.IsNullOrWhiteSpace(userName))\n            {\n                promptArgs.AppendFormat(\" --username {0}\", QuoteCmdArg(userName));\n            }\n\n            IDictionary<string, string> resultDict = await InvokeHelperAsync(command, promptArgs.ToString(), null);\n\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 GitCredential(userName, password);\n        }\n\n        private bool TryFindHelperCommand(out string command, out string args)\n        {\n            return TryFindHelperCommand(\n                Constants.EnvironmentVariables.GcmUiHelper,\n                Constants.GitConfiguration.Credential.UiHelper,\n                Constants.DefaultUiHelper,\n                out command,\n                out args);","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/git-ecosystem/git-credential-manager/blob/e8ce762cd04b4100ae637b5fbf39ef9d0a96561e/src/Core/Authentication/BasicAuthentication.cs#L97-L133","documentation":"The configured credential helper command was invoked successfully but its response dictionary contained no 'username' key, so BasicAuthentication cannot construct a GitCredential. This indicates a broken or non-conformant credential helper.","triggerScenarios":"GetCredentialsViaHelperAsync calls InvokeHelperAsync and then TryGetValue(\"username\", out userName); the helper's stdout did not include username=..., so the throw fires.","commonSituations":"A custom or third-party credential helper that does not emit Git's key=value protocol; a helper that exits successfully but prints nothing (e.g. it tried to prompt in a headless environment); a misconfigured helper path pointing at the wrong program.","solutions":["Verify the helper prints username=... and password=... lines on stdout (test it manually with the same command/args)","Fix or replace the non-conformant helper script","Reconfigure credential.helper to a known-good helper (e.g. GCM itself or git-credential-store)","Check the helper isn't swallowing output or prompting when it should print"],"exampleFix":"# before (custom helper prints JSON)\necho '{\"username\":\"u\",\"password\":\"p\"}'\n# after (Git helper protocol)\necho \"username=$USER\"\necho \"password=$PASS\"","handlingStrategy":"validation","validationCode":"// test helper output before use\nvar output = RunHelper(command, args);\nif (!output.Contains(\"username=\")) throw new InvalidOperationException(\"Helper does not emit username=\");","typeGuard":null,"tryCatchPattern":"try { /* get creds via helper */ }\ncatch (Trace2Exception ex) when (ex.Message.Contains(\"Missing 'username'\")) { /* reconfigure or repair helper */ }","preventionTips":["Test custom helpers against Git's key=value output protocol","Prefer maintained helpers (GCM, git-credential-store)","Enable GCM_TRACE to capture helper invocations"],"tags":["credential-helper","missing-username","protocol"],"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"}