{"record":{"id":"7afa4a1f144915be","repo":"git-ecosystem/git-credential-manager","slug":"missing-protocol-request-argument","errorCode":null,"errorMessage":"Missing 'protocol' request argument","messagePattern":"Missing 'protocol' request argument","errorType":"exception","errorClass":"Trace2InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Core/Commands/GitCommandBase.cs","lineNumber":60,"sourceCode":"            // Set the remote URI to scope settings to throughout the process from now on\n            Context.Settings.RemoteUri = request.GetRemoteUri();\n\n            // Determine the host provider\n            Context.Trace.WriteLine(\"Detecting host provider for request:\");\n            Context.Trace.WriteDictionarySecrets(inputDict, new []{ \"password\" }, StringComparer.OrdinalIgnoreCase);\n            IHostProvider provider = await _hostProviderRegistry.GetProviderAsync(request);\n            Context.Trace.WriteLine($\"Host provider '{provider.Name}' was selected.\");\n\n            await ExecuteInternalAsync(request, provider);\n\n            Context.Trace.WriteLine($\"End '{Name}' command...\");\n        }\n\n        protected virtual void EnsureMinimumRequest(GitRequest request)\n        {\n            if (request.Protocol is null)\n            {\n                throw new Trace2InvalidOperationException(Context.Trace2, \"Missing 'protocol' request argument\");\n            }\n\n            if (string.IsNullOrWhiteSpace(request.Protocol))\n            {\n                throw new Trace2InvalidOperationException(Context.Trace2,\n                    \"Invalid 'protocol' request argument (cannot be empty)\");\n            }\n\n            if (request.Host is null)\n            {\n                throw new Trace2InvalidOperationException(Context.Trace2, \"Missing 'host' request argument\");\n            }\n\n            if (string.IsNullOrWhiteSpace(request.Host))\n            {\n                throw new Trace2InvalidOperationException(Context.Trace2,\n                    \"Invalid 'host' request argument (cannot be empty)\");\n            }","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/git-ecosystem/git-credential-manager/blob/e8ce762cd04b4100ae637b5fbf39ef9d0a96561e/src/Core/Commands/GitCommandBase.cs#L42-L78","documentation":"GitCommandBase.EnsureMinimumRequest validates that the incoming GitRequest carries the required 'protocol' field before executing any git command. The request.Protocol property was null, meaning the git invocation (or caller constructing the request) did not supply the protocol portion of the URL/scheme (e.g. https, http, ssh). This is thrown as a Trace2InvalidOperationException so the failure is recorded in the Trace2 diagnostics.","triggerScenarios":"ExecuteAsync calls EnsureMinimumRequest and the GitRequest.Protocol property is null — i.e. the protocol request argument was never set by the caller or by argument parsing of the git credential input.","commonSituations":"Invoking `git credential fill/store/erase` (or a GCM command) through a wrapper that strips or omits the protocol= line from the key=value input; custom automation that builds a GitRequest programmatically but forgets to set Protocol; unusual Git remotes or transports that do not pass a protocol.","solutions":["Ensure the git credential input includes a `protocol=<scheme>` line (e.g. protocol=https) before invoking GCM.","If constructing a GitRequest in code, set request.Protocol explicitly to the URL scheme (https/http/ssh).","Update/repair the Git installation so it passes standard credential key/value pairs to the helper.","Check GCM tracing (GCM_TRACE) to see how the request was parsed if the input appears correct."],"exampleFix":"// before (programmatic request missing protocol)\nvar request = new GitRequest { Host = \"github.com\" };\n\n// after\nvar request = new GitRequest { Protocol = \"https\", Host = \"github.com\" };","handlingStrategy":"validation","validationCode":"if (string.IsNullOrEmpty(request.Protocol))\n    throw new ArgumentException(\"protocol must be provided, e.g. https\");","typeGuard":"bool HasProtocol(GitRequest r) => !string.IsNullOrEmpty(r.Protocol);","tryCatchPattern":"try\n{\n    await command.ExecuteAsync(input);\n}\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"'protocol'\"))\n{\n    // log and prompt for/repair the protocol argument\n}","preventionTips":["Always emit protocol=, host= in credential helper inputs.","Validate GitRequest fields before calling ExecuteAsync.","Keep Git installations current so standard keys are passed.","Enable GCM_TRACE during integration work."],"tags":["git","credential-helper","request-validation","missing-argument"],"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"}