chocolatey/choco · error · ApplicationException

A single package name is required to run the choco info comm

Error message

A single package name is required to run the choco info command.

What it means

The info command (a synonym for 'choco search <pkg> --exact --detailed') requires exactly one package name. Validate() throws if configuration.Input is blank, because there is nothing to look up.

Source

Thrown at src/chocolatey/infrastructure.app/commands/ChocolateyInfoCommand.cs:96

                    "Include Configured Sources - When using the '--source' option, this appends the sources that have been saved into the chocolatey.config file by 'source' command.  Available in 2.3.0+",
                    option => configuration.IncludeConfiguredSources = option != null)
                ;
        }

        public override void ParseAdditionalArguments(IList<string> unparsedArguments, ChocolateyConfiguration configuration)
        {
            configuration.Input = string.Join(" ", unparsedArguments);
            configuration.Verbose = true;
            configuration.ListCommand.Exact = true;
        }

        public override void Validate(ChocolateyConfiguration configuration)
        {
            base.Validate(configuration);

            if (string.IsNullOrWhiteSpace(configuration.Input))
            {
                throw new ApplicationException("A single package name is required to run the choco info command.");
            }

            // Validate only a single package has been passed to info
            // TODO: Provide ability to get info on a list of packages. See https://github.com/chocolatey/choco/issues/2905
            var input = configuration.Input.Split(' ');
            if (input.Length > 1)
            {
                throw new ApplicationException("Only a single package name can be passed to the choco info command.");
            }
        }

        public override void HelpMessage(ChocolateyConfiguration configuration)
        {
            this.Log().Info(ChocolateyLoggers.Important, "Info Command");
            this.Log().Info(@"
Chocolatey will perform a search for a package local or remote and provide
 detailed information about that package. This is a synonym for
 `choco search <pkgname> --exact --detailed`.

View on GitHub (pinned to 0d5abdd10c)

Solutions

  1. Supply a package name: 'choco info <pkg>'.
  2. In scripts, guard the call so it only runs when the package variable is non-empty.
  3. Use 'choco search' if you want optional/empty queries.

Example fix

# before
choco info

# after
choco info chocolatey
Defensive patterns

Strategy: validation

Validate before calling

// Ensure a package name before calling info.
if (string.IsNullOrWhiteSpace(pkg))
{
    throw new InvalidOperationException("choco info requires a package name");
}
RunChoco($"info {pkg}");

Prevention

When it happens

Trigger: Running 'choco info' with no package name argument at all.

Common situations: Running a bare 'choco info'; scripting that builds the command without a package variable; a variable expanding to empty.

Related errors


AI-assisted analysis of chocolatey/choco@0d5abdd10c (2026-08-13). Data as JSON: /api/errors/575e71ca029eebf0. Report an issue: GitHub.