chocolatey/choco · error · ApplicationException
The page size has been specified to be {0:N0} packages. The
Error message
The page size has been specified to be {0:N0} packages. The page size cannot be lower than 1 package, and no larger than 100 packages. What it means
Thrown by ChocolateySearchCommand.Validate when configuration.ListCommand.PageSize is less than 1 or greater than 100. The page size controls how many packages are fetched per page from remote sources. Values outside [1, 100] are rejected. The {0:N0} format specifier renders the number with thousands separators.
Source
Thrown at src/chocolatey/infrastructure.app/commands/ChocolateySearchCommand.cs:190
public virtual void ParseAdditionalArguments(IList<string> unparsedArguments, ChocolateyConfiguration configuration)
{
configuration.Input = string.Join(" ", unparsedArguments);
}
public virtual void Validate(ChocolateyConfiguration configuration)
{
if (!string.IsNullOrWhiteSpace(configuration.SourceCommand.Username) && string.IsNullOrWhiteSpace(configuration.SourceCommand.Password))
{
this.Log().Debug(ChocolateyLoggers.LogFileOnly, "Username '{0}' provided. Asking for password.".FormatWith(configuration.SourceCommand.Username));
System.Console.Write("User name '{0}' provided. Password: ".FormatWith(configuration.SourceCommand.Username));
configuration.SourceCommand.Password = InteractivePrompt.GetPassword(configuration.PromptForConfirmation);
}
if (configuration.ListCommand.PageSize < 1 || configuration.ListCommand.PageSize > 100)
{
var message = "The page size has been specified to be {0:N0} packages. The page size cannot be lower than 1 package, and no larger than 100 packages.".FormatWith(configuration.ListCommand.PageSize);
throw new ApplicationException(message);
}
}
public virtual void HelpMessage(ChocolateyConfiguration configuration)
{
this.Log().Info(ChocolateyLoggers.Important, "Search Command");
this.Log().Info(@"
Chocolatey will perform a search for a package local or remote.
");
"chocolatey".Log().Info(ChocolateyLoggers.Important, "Usage");
// TODO: use command name in usage and examples, instead of hard
// coding the names?
"chocolatey".Log().Info(@"
choco find <filter> [<options/switches>]
choco search <filter> [<options/switches>]
");
View on GitHub (pinned to 0d5abdd10c)
Solutions
- Set --page-size to a value between 1 and 100 inclusive: 'choco search --page-size=30'.
- To retrieve more total results, combine --page-size with --page (pagination), not a single huge page size.
- Omit --page-size entirely to use the default page size.
Example fix
// before choco search --page-size=500 // after choco search --page-size=100 --page=1 choco search --page-size=100 --page=2
Defensive patterns
Strategy: validation
Validate before calling
// Validate page size range before calling search
if (pageSize < 1 || pageSize > 100)
{
Console.Error.WriteLine($"Page size {pageSize} is out of range [1, 100].");
} Type guard
static bool IsValidPageSize(int size) => size >= 1 && size <= 100;
Prevention
- Keep --page-size between 1 and 100 inclusive.
- Use --page for pagination instead of inflating page-size.
When it happens
Trigger: Passing '--page-size=0', '--page-size=-1', '--page-size=101', or '--page-size=500'. Any integer value outside the 1–100 inclusive range triggers this during validation.
Common situations: User misunderstands page-size as total result count and sets it very high (e.g. 1000). Script bug sets page-size from an unvalidated variable. Negative values from sign errors in arithmetic.
Related errors
- No '--order-by' clause was provided. Specify one of the supp
- The '--order-by' clause '{0}' is not recognized. Use one of
- Automatic package creation from installer files only availab
- A single pin command must be listed. Please see the help men
- When specifying the subcommand '{0}', you must also specify
AI-assisted analysis of chocolatey/choco@0d5abdd10c (2026-08-13).
Data as JSON: /api/errors/1b2ed46a59f6e0a0.
Report an issue: GitHub.