{"record":{"id":"ad4c30a6c2f0924a","repo":"git-ecosystem/git-credential-manager","slug":"cannot-prompt-because-user-interactivity-has-been","errorCode":null,"errorMessage":"Cannot prompt because user interactivity has been disabled.","messagePattern":"Cannot prompt because user interactivity has been disabled\\.","errorType":"exception","errorClass":"Trace2InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Core/Authentication/AuthenticationBase.cs","lineNumber":96,"sourceCode":"                }\n\n                throw new Trace2Exception(Context.Trace2, $\"helper error ({exitCode}): {errorMessage}\");\n            }\n\n            return resultDict;\n        }\n\n        protected void ThrowIfUserInteractionDisabled()\n        {\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.\");","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/git-ecosystem/git-credential-manager/blob/e8ce762cd04b4100ae637b5fbf39ef9d0a96561e/src/Core/Authentication/AuthenticationBase.cs#L78-L114","documentation":"ThrowIfUserInteractionDisabled checks the GCM_INTERACTIVE environment variable / credential.interactive Git config. If set to false/never, any code path that would prompt the user throws Trace2InvalidOperationException because prompting is explicitly forbidden by configuration.","triggerScenarios":"Calling a credential flow that needs to show a prompt (UI dialog or terminal question) while GCM_INTERACTIVE=never (env) or credential.interactive=false/never (Git config) is in effect.","commonSituations":"CI/CD pipelines or headless servers where GCM_INTERACTIVE=never was set but no cached credential exists; Docker builds running git fetch; scripts that disable prompting yet still expect fresh logins.","solutions":["Pre-provision credentials non-interactively (e.g. `git credential approve` with a PAT, or embed token in remote URL / credential store).","Remove the restriction: unset GCM_INTERACTIVE or set credential.interactive=true if prompting is acceptable.","Ensure a valid cached credential exists in the configured store (credential.helper / GCM cache) before running non-interactive."],"exampleFix":"// before: non-interactive with no cached credential -> throws\nexport GCM_INTERACTIVE=never\ngit pull\n// after: pre-seed the credential\nprintf \"protocol=https\\nhost=bitbucket.example.com\\nusername=user\\npassword=TOKEN\\n\" | git credential approve\nexport GCM_INTERACTIVE=never\ngit pull","handlingStrategy":"validation","validationCode":"#!/bin/sh\nif [ \"$GCM_INTERACTIVE\" = \"never\" ] || [ \"$(git config --get credential.interactive)\" = \"never\" ]; then\n  printf \"protocol=https\\nhost=bitbucket.example.com\\n\" | git credential fill >/dev/null 2>&1 \\\n    || { echo \"No cached credential and prompting disabled\"; exit 1; }\nfi","typeGuard":null,"tryCatchPattern":"try { var cred = await auth.GetCredentialAsync(input); } catch (InvalidOperationException ex) when (ex.Message.Contains(\"user interactivity has been disabled\")) { /* fail fast and instruct CI to pre-provision credentials */ }","preventionTips":["In CI, always pre-seed credentials via `git credential approve` or a deploy key","Only set GCM_INTERACTIVE=never when a cached credential is guaranteed","Document the interactive/non-interactive contract for your team"],"tags":["configuration","non-interactive","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"}