chocolatey/choco · error · ApplicationException
Invalid argument {0}. This argument has been removed from th
Error message
Invalid argument {0}. This argument has been removed from the list command and cannot be used. What it means
The list command (v2+) is local-only and removed several v1 arguments. ParseAdditionalArguments throws when a token matches the unsupported list (_unsupportedArguments: -l, -lo, --lo, -local, --local, -localonly, --localonly, -local-only, --local-only, -a, -all, --all, -allversions, --allversions, -all-versions, --all-versions, -order-by-popularity, --order-by-popularity) or registry-programs (_unsupportedIncludeRegistryProgramsArguments: -li, -il, -lai, etc.) sets AND configuration.RegularOutput is true. In non-regular output mode these are silently ignored/warned instead.
Source
Thrown at src/chocolatey/infrastructure.app/commands/ChocolateyListCommand.cs:165
config.QuietOutput = true;
return _packageService.Count(config);
}
public virtual void ParseAdditionalArguments(IList<string> unparsedArguments, ChocolateyConfiguration configuration)
{
var argumentsWithoutLocalOnly = new List<string>(unparsedArguments.Count);
foreach (var argument in unparsedArguments)
{
var isUnsupportedArgument = _unsupportedArguments.Contains(argument, StringComparer.OrdinalIgnoreCase);
var isUnsupportedRegistryProgramsArgument = _unsupportedIncludeRegistryProgramsArguments.Contains(argument, StringComparer.OrdinalIgnoreCase);
if (isUnsupportedArgument || isUnsupportedRegistryProgramsArgument)
{
if (configuration.RegularOutput)
{
throw new ApplicationException("Invalid argument {0}. This argument has been removed from the list command and cannot be used.".FormatWith(argument));
}
if (isUnsupportedRegistryProgramsArgument)
{
configuration.ListCommand.IncludeRegistryPrograms = true;
}
this.Log().Warn(ChocolateyLoggers.LogFileOnly, "Ignoring the argument {0}. This argument is unsupported for locally installed packages.", argument);
}
else
{
argumentsWithoutLocalOnly.Add(argument);
}
}
configuration.Input = string.Join(" ", argumentsWithoutLocalOnly);
}
View on GitHub (pinned to 0d5abdd10c)
Solutions
- Drop the removed flag: 'choco list' is already local-only in v2+.
- For all versions, use 'choco list --by-id-only' patterns or the appropriate v2 options, removing --allversions.
- For registry programs, use the supported --include-programs equivalent rather than -li.
Example fix
# before choco list --local-only --allversions # after choco list
Defensive patterns
Strategy: validation
Validate before calling
// Strip/replace removed v1 list flags before invoking v2 'choco list'.
var removed = new[] { "-l","-lo","--lo","-local","--local","-localonly","--localonly",
"-local-only","--local-only","-a","-all","--all","-allversions","--allversions",
"-all-versions","--all-versions","-order-by-popularity","--order-by-popularity",
"-li","-il","-lai","-lia","-ali","-ail","-ial","-ila" };
var clean = tokens.Where(t => !removed.Contains(t, StringComparer.OrdinalIgnoreCase)).ToList();
RunChoco("list " + string.Join(" ", clean)); Type guard
static bool IsRemovedListFlag(string arg) =>
removedFlags.Contains(arg, StringComparer.OrdinalIgnoreCase); Prevention
- When migrating from v1, remove --local-only/--allversions/--all/--order-by-popularity from list scripts.
- Run 'choco list -?' to learn the v2-supported options.
- In non-regular output mode these are only warned, but keep scripts clean anyway.
When it happens
Trigger: Running 'choco list -lo', 'choco list --allversions', 'choco list -a', 'choco list -order-by-popularity', or 'choco list -li' with regular output (interactive/normal verbosity).
Common situations: Upgrading from Chocolatey v1 scripts that used --local-only or --all-versions; copy-pasting old docs; CI scripts carrying legacy list flags.
Related errors
- A single apikey command must be listed. Please see the help
- A single config command must be listed. Please see the help
- A single feature command must be listed. Please see the help
- A single license command must be listed. Please see the help
- When using the '--source' option with the 'choco list' comma
AI-assisted analysis of chocolatey/choco@0d5abdd10c (2026-08-13).
Data as JSON: /api/errors/66cb038ae85135e4.
Report an issue: GitHub.