{"record":{"id":"5f3b6a5378c6f135","repo":"chocolatey/choco","slug":"a-single-pin-command-must-be-listed-please-see-th","errorCode":null,"errorMessage":"A single pin command must be listed. Please see the help menu for those commands","messagePattern":"A single pin command must be listed\\. Please see the help menu for those commands","errorType":"validation","errorClass":"ApplicationException","httpStatus":null,"severity":"error","filePath":"src/chocolatey/infrastructure.app/commands/ChocolateyPinCommand.cs","lineNumber":68,"sourceCode":"        public virtual void ConfigureArgumentParser(OptionSet optionSet, ChocolateyConfiguration configuration)\r\n        {\r\n            optionSet\r\n                .Add(\"n=|name=\",\r\n                     \"Name - the name of the package. Required with some actions. Defaults to empty.\",\r\n                     option => configuration.PinCommand.Name = option.UnquoteSafe())\r\n                .Add(\"version=\",\r\n                     \"Version - Used when multiple versions of a package are installed.  Defaults to empty.\",\r\n                     option => configuration.Version = option.UnquoteSafe())\r\n                ;\r\n        }\r\n\r\n        public virtual void ParseAdditionalArguments(IList<string> unparsedArguments, ChocolateyConfiguration configuration)\r\n        {\r\n            // don't set configuration.Input or it will be passed to list\r\n\r\n            if (unparsedArguments.Count > 1)\r\n            {\r\n                throw new ApplicationException(\"A single pin command must be listed. Please see the help menu for those commands\");\r\n            }\r\n\r\n            var command = PinCommandType.Unknown;\r\n            var unparsedCommand = unparsedArguments.DefaultIfEmpty(string.Empty).FirstOrDefault();\r\n            Enum.TryParse(unparsedCommand, true, out command);\r\n\r\n            if (command == PinCommandType.Unknown)\r\n            {\r\n                if (!string.IsNullOrWhiteSpace(unparsedCommand))\r\n                {\r\n                    this.Log().Warn(\"Unknown command {0}. Setting to list.\".FormatWith(unparsedCommand));\r\n                }\r\n\r\n                command = PinCommandType.List;\r\n            }\r\n\r\n            configuration.PinCommand.Command = command;\r\n            configuration.Sources = ApplicationParameters.PackagesLocation;\r","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/chocolatey/choco/blob/0d5abdd10cc177a141e69547cad6935b419b6c17/src/chocolatey/infrastructure.app/commands/ChocolateyPinCommand.cs#L50-L86","documentation":"Thrown by ChocolateyPinCommand.ParseAdditionalArguments when more than one unparsed positional argument is passed to the 'choco pin' command. The pin command accepts exactly one subcommand verb (list, add, remove); passing two or more positional tokens is ambiguous and rejected before any parsing of the subcommand type.","triggerScenarios":"Running 'choco pin add remove' or 'choco pin list add' — i.e. supplying two or more subcommand verbs in a single invocation. Any call where unparsedArguments.Count exceeds 1.","commonSituations":"User misunderstands the CLI syntax and chains multiple pin operations in one command instead of running them separately. Or a script erroneously concatenates multiple operations.","solutions":["Pass only a single pin subcommand per invocation: 'choco pin list', 'choco pin add --name=pkg', or 'choco pin remove --name=pkg'.","If scripting multiple pin operations, issue separate 'choco pin' calls for each.","Run 'choco pin --help' to review the accepted subcommands."],"exampleFix":"// before\nchoco pin add remove --name=mypkg\n// after\nchoco pin add --name=mypkg\nchoco pin remove --name=mypkg","handlingStrategy":"validation","validationCode":"// Ensure only one positional subcommand is passed\nif (positionalArgs.Count(arg => !arg.StartsWith(\"-\")) > 1)\n{\n    Console.Error.WriteLine(\"Pass a single pin subcommand (list, add, or remove).\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Issue each pin operation as a separate 'choco pin <subcommand>' call.","Validate argument count before invoking the CLI."],"tags":["chocolatey","pin-command","argument-validation","cli-usage"],"backgroundTag":null,"analyzedSha":"0d5abdd10cc177a141e69547cad6935b419b6c17","analyzedAt":"2026-08-13T18:33:03.301Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}