{"record":{"id":"80c1075d03042fb9","repo":"git-ecosystem/git-credential-manager","slug":"cannot-show-prompt-because-gui-prompts-have-been-d","errorCode":null,"errorMessage":"Cannot show prompt because GUI prompts have been disabled.","messagePattern":"Cannot show prompt because GUI prompts have been disabled\\.","errorType":"exception","errorClass":"Trace2InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Core/Authentication/AuthenticationBase.cs","lineNumber":105,"sourceCode":"        {\n            if (!Context.Settings.IsInteractionAllowed)\n            {\n                string envName = Constants.EnvironmentVariables.GcmInteractive;\n                string cfgName = string.Format(\"{0}.{1}\",\n                    Constants.GitConfiguration.Credential.SectionName,\n                    Constants.GitConfiguration.Credential.Interactive);\n\n                Context.Trace.WriteLine($\"{envName} / {cfgName} is false/never; user interactivity has been disabled.\");\n                throw new Trace2InvalidOperationException(Context.Trace2, \"Cannot prompt because user interactivity has been disabled.\");\n            }\n        }\n\n        protected void ThrowIfGuiPromptsDisabled()\n        {\n            if (!Context.Settings.IsGuiPromptsEnabled)\n            {\n                Context.Trace.WriteLine($\"{Constants.EnvironmentVariables.GitTerminalPrompts} is 0; GUI prompts have been disabled.\");\n                throw new Trace2InvalidOperationException(Context.Trace2, \"Cannot show prompt because GUI prompts have been disabled.\");\n            }\n        }\n\n        protected void ThrowIfTerminalPromptsDisabled()\n        {\n            if (!Context.Settings.IsTerminalPromptsEnabled)\n            {\n                Context.Trace.WriteLine($\"{Constants.EnvironmentVariables.GitTerminalPrompts} is 0; terminal prompts have been disabled.\");\n                throw new Trace2InvalidOperationException(Context.Trace2, \"Cannot prompt because terminal prompts have been disabled.\");\n            }\n        }\n        \n        protected void ThrowIfWindowCancelled(WindowViewModel viewModel)\n        {\n            if (!viewModel.WindowResult)\n            {\n                throw new OperationCanceledException(\"User cancelled dialog.\");\n            }","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/git-ecosystem/git-credential-manager/blob/e8ce762cd04b4100ae637b5fbf39ef9d0a96561e/src/Core/Authentication/AuthenticationBase.cs#L87-L123","documentation":"ThrowIfGuiPromptsDisabled checks Context.Settings.IsGuiPromptsEnabled, driven by GIT_TERMINAL_PROMPT=0 / GCM's GUI prompt settings. When GUI prompts are disabled but the flow tries to show a GUI authentication dialog, it throws Trace2InvalidOperationException.","triggerScenarios":"An authentication flow that requires a GUI dialog runs while GIT_TERMINAL_PROMPT=0 (or equivalent GUI-prompts-off config) is set — commonly in CI or SSH sessions without a display.","commonSituations":"CI runners exporting GIT_TERMINAL_PROMPT=0 to avoid hangs; WSL/SSH without X forwarding attempting OAuth browser/GUI flows; automation that disables prompts but invokes a GUI-based provider flow.","solutions":["Enable GUI prompts (unset GIT_TERMINAL_PROMPT=0) or switch to a non-GUI authentication mode (PAT via credential store, basic auth).","Use a credential helper flow that does not need a display: pre-approve a token with `git credential approve`.","In SSH/WSL, set up display forwarding or use terminal-prompt capable flows."],"exampleFix":"// before\nexport GIT_TERMINAL_PROMPT=0\ngit pull   # GUI prompt required -> throws\n// after: use PAT provisioned non-interactively\nprintf \"protocol=https\\nhost=bitbucket.example.com\\nusername=user\\npassword=TOKEN\\n\" | git credential approve\nexport GIT_TERMINAL_PROMPT=0\ngit pull","handlingStrategy":"validation","validationCode":"#!/bin/sh\nif [ \"$GIT_TERMINAL_PROMPT\" = \"0\" ]; then\n  printf \"protocol=https\\nhost=bitbucket.example.com\\n\" | git credential fill >/dev/null 2>&1 \\\n    || { echo \"GUI prompts disabled and no cached credential\"; exit 1; }\nfi","typeGuard":null,"tryCatchPattern":"try { var cred = await auth.GetCredentialAsync(input); } catch (InvalidOperationException ex) when (ex.Message.Contains(\"GUI prompts have been disabled\")) { /* switch to PAT/token-based flow or enable prompts */ }","preventionTips":["Use PAT or token-based credentials wherever GIT_TERMINAL_PROMPT=0 is set","Enable display/X-forwarding for GUI flows over SSH/WSL","Audit CI images for prompt-disabling env vars before adding OAuth flows"],"tags":["configuration","gui","ci","git-credential-manager"],"backgroundTag":"prompting-disabled","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"}