{"record":{"id":"3293fd7c69742071","repo":"git-ecosystem/git-credential-manager","slug":"missing-host-request-argument","errorCode":null,"errorMessage":"Missing 'host' request argument","messagePattern":"Missing 'host' request argument","errorType":"exception","errorClass":"Trace2InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Core/Commands/GitCommandBase.cs","lineNumber":71,"sourceCode":"            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            }\n        }\n\n        /// <summary>\n        /// Execute the command using the given <see cref=\"GitRequest\"/> and <see cref=\"IHostProvider\"/>.\n        /// </summary>\n        /// <param name=\"request\">Input arguments of the current Git credential query.</param>\n        /// <param name=\"provider\">Host provider for the current <see cref=\"GitRequest\"/>.</param>\n        /// <returns>Awaitable task for the command execution.</returns>\n        protected abstract Task ExecuteInternalAsync(GitRequest request, IHostProvider provider);\n    }\n}","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/git-ecosystem/git-credential-manager/blob/e8ce762cd04b4100ae637b5fbf39ef9d0a96561e/src/Core/Commands/GitCommandBase.cs#L53-L89","documentation":"EnsureMinimumRequest requires a 'host' argument: the hostname of the remote Git server for which credentials are being stored/retrieved. request.Host was null, so GCM cannot identify which credential to look up. Thrown as a Trace2InvalidOperationException.","triggerScenarios":"ExecuteAsync -> EnsureMinimumRequest where request.Host is null — the credential input lacked a `host=` line or the request builder never populated Host.","commonSituations":"Manual/automated `git credential` invocations missing the host line; helpers or scripts feeding GCM only protocol/path; corrupted git configuration for a remote; integration tests that construct partial GitRequest objects.","solutions":["Include a `host=<hostname>` line (e.g. host=github.com) in the credential input.","When building a GitRequest in code, set request.Host to the remote server hostname.","Verify `git remote -v` URLs are well-formed so Git derives the host correctly.","Re-run with GCM_TRACE=1 to inspect the parsed request fields."],"exampleFix":"// before (programmatic request missing host)\nvar request = new GitRequest { Protocol = \"https\" };\n\n// after\nvar request = new GitRequest { Protocol = \"https\", Host = \"github.com\" };","handlingStrategy":"validation","validationCode":"if (string.IsNullOrEmpty(request.Host))\n    throw new ArgumentException(\"host must be provided, e.g. github.com\");","typeGuard":"bool HasHost(GitRequest r) => !string.IsNullOrEmpty(r.Host);","tryCatchPattern":"try\n{\n    await command.ExecuteAsync(input);\n}\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"'host'\"))\n{\n    // log the raw input; require a host before proceeding\n}","preventionTips":["Derive host from git remote -v before composing credential input.","Validate all required keys (protocol, host) exist in the input set.","Check remote URLs are complete after cloning/migrating repos.","Test custom helper integrations with a full key/value payload."],"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"}