{"record":{"id":"7440287eef8771f8","repo":"git-ecosystem/git-credential-manager","slug":"unknown-authentication-mode-744028","errorCode":null,"errorMessage":"Unknown authentication mode","messagePattern":"Unknown authentication mode","errorType":"exception","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"src/Atlassian.Bitbucket/UI/Commands/CredentialsCommand.cs","lineNumber":69,"sourceCode":"            {\n                case AuthenticationModes.OAuth:\n                    WriteResult(new Dictionary<string, string>\n                    {\n                        [\"mode\"] = \"oauth\"\n                    });\n                    break;\n\n                case AuthenticationModes.Basic:\n                    WriteResult(new Dictionary<string, string>\n                    {\n                        [\"mode\"] = \"basic\",\n                        [\"username\"] = viewModel.UserName,\n                        [\"password\"] = viewModel.Password,\n                    });\n                    break;\n\n                default:\n                    throw new ArgumentOutOfRangeException(nameof(AuthenticationModes),\n                        \"Unknown authentication mode\", viewModel.SelectedMode.ToString());\n            }\n\n            return 0;\n        }\n\n        protected abstract Task ShowAsync(CredentialsViewModel viewModel, CancellationToken ct);\n    }\n}\n","sourceCodeStart":51,"sourceCodeEnd":79,"githubUrl":"https://github.com/git-ecosystem/git-credential-manager/blob/e8ce762cd04b4100ae637b5fbf39ef9d0a96561e/src/Atlassian.Bitbucket/UI/Commands/CredentialsCommand.cs#L51-L79","documentation":"After the dialog returns, ExecuteAsync switches on viewModel.SelectedMode and writes the credential result. An unrecognized mode falls into the default case, throwing ArgumentOutOfRangeException(\"Unknown authentication mode\") — an internal invariant violation meaning the AuthenticationModes enum gained a value the command does not handle.","triggerScenarios":"viewModel.SelectedMode contains a value not covered by the handled AuthenticationModes cases (OAuth, Basic, etc.) — usually only possible when the enum and the switch are out of sync after a code change, or corrupted state.","commonSituations":"Developers adding a new AuthenticationModes member without updating CredentialsCommand's switch; users on mismatched GCM builds/plugins; bespoke forks extending the enum.","solutions":["Upgrade or reinstall git-credential-manager so the UI and command code are from the same version.","If you build from source, add a case for the new AuthenticationModes value in CredentialsCommand.ExecuteAsync.","Report a bug with trace2 logs if it occurs on an unmodified release build."],"exampleFix":"// before\ndefault:\n    throw new ArgumentOutOfRangeException(nameof(AuthenticationModes), \"Unknown authentication mode\", viewModel.SelectedMode.ToString());\n// after: handle the new mode explicitly\ncase AuthenticationModes.BearerToken:\n    WriteResult(new Dictionary<string, string> { [\"password\"] = viewModel.Token });\n    break;","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"Enum.IsDefined(typeof(AuthenticationModes), viewModel.SelectedMode)","tryCatchPattern":"try { await command.ExecuteAsync(input); } catch (ArgumentOutOfRangeException ex) when (ex.Message.Contains(\"Unknown authentication mode\")) { /* upgrade GCM or report bug with trace2 logs */ }","preventionTips":["Keep UI and CredentialsCommand builds version-aligned","When extending AuthenticationModes, update the switch in ExecuteAsync in the same change","Pin a single GCM installation rather than mixing distro and manual installs"],"tags":["bitbucket","enum","unhandled-case","git-credential-manager"],"backgroundTag":"invalid-enum-value","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"}