{"record":{"id":"67864daad194726a","repo":"git-ecosystem/git-credential-manager","slug":"at-least-one-authenticationmodes-must-be-supplied","errorCode":null,"errorMessage":"At least one AuthenticationModes must be supplied","messagePattern":"At least one AuthenticationModes must be supplied","errorType":"exception","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"src/Atlassian.Bitbucket/BitbucketAuthentication.cs","lineNumber":181,"sourceCode":"                    }\n                    else\n                    {\n                        // Prompt for username\n                        userName = await TerminalPrompts.CreateText(\"Username\").ShowAsync(Context.Console);\n                    }\n\n                    // Prompt for password\n                    string password = await TerminalPrompts.CreateSecret(\"Password\").ShowAsync(Context.Console);\n\n                    return new CredentialsPromptResult(\n                        AuthenticationModes.Basic,\n                        new GitCredential(userName, password));\n\n                case AuthenticationModes.OAuth:\n                    return new CredentialsPromptResult(AuthenticationModes.OAuth);\n\n                case AuthenticationModes.None:\n                    throw new ArgumentOutOfRangeException(nameof(modes),\n                        @$\"At least one {nameof(AuthenticationModes)} must be supplied\");\n\n                default:\n                    var promptTitle = $\"Select an authentication method for '{targetUri}'\";\n                    var prompt = TerminalPrompts.CreateSelection<AuthenticationModes>()\n                        .Title(promptTitle);\n\n                    if ((modes & AuthenticationModes.OAuth) != 0) prompt.AddChoice(\"OAuth\", AuthenticationModes.OAuth);\n                    if ((modes & AuthenticationModes.Basic) != 0) prompt.AddChoice(\"Username/password\", AuthenticationModes.Basic);\n\n                    AuthenticationModes choice = await prompt.ShowAsync(Context.Console);\n\n                    if (choice == AuthenticationModes.OAuth) goto case AuthenticationModes.OAuth;\n                    if (choice == AuthenticationModes.Basic) goto case AuthenticationModes.Basic;\n\n                    throw new Exception();\n            }\n        }","sourceCodeStart":163,"sourceCodeEnd":199,"githubUrl":"https://github.com/git-ecosystem/git-credential-manager/blob/e8ce762cd04b4100ae637b5fbf39ef9d0a96561e/src/Atlassian.Bitbucket/BitbucketAuthentication.cs#L163-L199","documentation":"GetCredentialsViaTtyAsync (terminal prompt path) throws ArgumentOutOfRangeException when the resolved mode is AuthenticationModes.None, mirroring the up-front validation in GetCredentialsAsync. The terminal flow cannot prompt when no authentication mode is supplied.","triggerScenarios":"GetCredentialsAsync invoked without a GUI/desktop session so the TTY path runs, with modes == AuthenticationModes.None (e.g. all auth modes disabled in settings).","commonSituations":"Running git push/pull in a terminal with misconfigured GCM settings that disable every Bitbucket auth mode; scripting calls to GetCredentialsAsync with modes: None.","solutions":["Enable at least one auth mode in GCM settings (e.g. set GCM_BITBUCKET_AUTHMODES to Basic or OAuth)","Pass a valid modes bitmask when calling GetCredentialsAsync directly","Verify GetSupportedAuthenticationModesAsync inputs (host, settings) are not filtering out all modes"],"exampleFix":"// before\nawait auth.GetCredentialsAsync(uri, null, AuthenticationModes.None);\n// after\nawait auth.GetCredentialsAsync(uri, null, AuthenticationModes.OAuth);","handlingStrategy":"validation","validationCode":"if (modes == AuthenticationModes.None)\n    modes = AuthenticationModes.Basic | AuthenticationModes.OAuth; // ensure at least one","typeGuard":"bool CanPrompt(AuthenticationModes m) => m != AuthenticationModes.None;","tryCatchPattern":"try { await auth.GetCredentialsAsync(uri, user, modes); }\ncatch (ArgumentOutOfRangeException ex) { trace.Error(ex); throw new InvalidOperationException(\"No auth mode configured\", ex); }","preventionTips":["Check that GCM auth-mode settings do not disable all modes","Compute modes via GetSupportedAuthenticationModesAsync before prompting","Test both GUI and TTY paths in CI"],"tags":["argument-out-of-range","terminal","authentication","bitbucket"],"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"}