{"record":{"id":"aee61bfcd4d388a4","repo":"git-ecosystem/git-credential-manager","slug":"missing-username-in-response","errorCode":null,"errorMessage":"Missing username in response","messagePattern":"Missing username in response","errorType":"exception","errorClass":"Trace2Exception","httpStatus":null,"severity":"error","filePath":"src/Atlassian.Bitbucket/BitbucketAuthentication.cs","lineNumber":237,"sourceCode":"            }\n\n            if ((modes & AuthenticationModes.OAuth) != 0)\n            {\n                promptArgs.Append(\" --show-oauth\");\n            }\n\n            IDictionary<string, string> output = await InvokeHelperAsync(helperCommand, promptArgs.ToString());\n\n            if (output.TryGetValue(\"mode\", out string mode) &&\n                StringComparer.OrdinalIgnoreCase.Equals(mode, \"oauth\"))\n            {\n                return new CredentialsPromptResult(AuthenticationModes.OAuth);\n            }\n            else\n            {\n                if (!output.TryGetValue(\"username\", out userName))\n                {\n                    throw new Trace2Exception(Context.Trace2, \"Missing username in response\");\n                }\n\n                if (!output.TryGetValue(\"password\", out string password))\n                {\n                    throw new Trace2Exception(Context.Trace2, \"Missing password in response\");\n                }\n\n                return new CredentialsPromptResult(\n                    AuthenticationModes.Basic,\n                    new GitCredential(userName, password));\n            }\n        }\n\n        public async Task<OAuth2TokenResult> CreateOAuthCredentialsAsync(GitRequest request)\n        {\n            ThrowIfUserInteractionDisabled();\n\n            var browserOptions = new OAuth2WebBrowserOptions","sourceCodeStart":219,"sourceCodeEnd":255,"githubUrl":"https://github.com/git-ecosystem/git-credential-manager/blob/e8ce762cd04b4100ae637b5fbf39ef9d0a96561e/src/Atlassian.Bitbucket/BitbucketAuthentication.cs#L219-L255","documentation":"When credentials are collected by the external UI helper process (GetCredentialsViaHelperAsync), the helper's JSON output must contain a 'username' key. If it is absent the library cannot build a GitCredential and throws Trace2Exception 'Missing username in response'. This usually indicates a broken or non-GCM UI helper binary.","triggerScenarios":"GetCredentialsAsync -> GetCredentialsViaHelperAsync parses the helper's dictionary output and output.TryGetValue(\"username\", out userName) returns false — e.g. helper exited partially or returned only some keys.","commonSituations":"Stale/mismatched atlassian-bitbucket-ui-helper.exe on PATH from a different GCM version; helper crashed mid-run and emitted partial output; custom or third-party UI helpers.","solutions":["Reinstall/upgrade Git Credential Manager so the Bitbucket UI helper binary matches the current version","Remove stale duplicate helper binaries from PATH","Run with GCM_TRACE/Trace2 enabled to capture the helper's raw output and diagnose the partial response"],"exampleFix":"// before\n// helper returns {\"password\":\"...\"} (no username)\n// after\n// helper must return {\"username\":\"user\",\"password\":\"...\"}; reinstall matching GCM helper","handlingStrategy":"try-catch","validationCode":"var proc = FindHelperBinary();\nif (proc == null || !File.Exists(proc)) throw new InvalidOperationException(\"UI helper missing/stale\");","typeGuard":"bool HasUsername(Dictionary<string,string> o) => o.TryGetValue(\"username\", out var u) && !string.IsNullOrEmpty(u);","tryCatchPattern":"try { await auth.GetCredentialsAsync(uri, user, modes); }\ncatch (Trace2Exception ex) { trace.Error(ex); return null; } // fall back to terminal prompt","preventionTips":["Keep GCM and the Bitbucket UI helper binaries from the same install","Avoid multiple helper copies on PATH","Enable GCM tracing when automating prompts to detect partial helper output early"],"tags":["ui-helper","ipc","authentication","unexpected-response"],"backgroundTag":"unexpected-response-shape","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"}