chocolatey/choco · error · Exception
Could not find a command registered that meets '{0}'. Try c
Error message
Could not find a command registered that meets '{0}'.
Try choco --help for command reference/help. What it means
Thrown by GenericRunner.FindCommand when config.CommandName is non-empty but no registered ICommand implementation has a CommandForAttribute matching that name. Chocolatey uses a DI container to register all commands (install, upgrade, uninstall, etc.) and resolves them by name via attribute lookup. An unrecognized command name means the user typed something Chocolatey cannot dispatch.
Source
Thrown at src/chocolatey/infrastructure.app/runners/GenericRunner.cs:56
namespace chocolatey.infrastructure.app.runners
{
public sealed class GenericRunner
{
private ICommand FindCommand(ChocolateyConfiguration config, Container container, bool isConsole, Action<ICommand> parseArgs)
{
var commands = container.GetAllInstances<ICommand>();
var command = commands.Where((c) =>
{
var attributes = c.GetType().GetCustomAttributes(typeof(CommandForAttribute), false);
return attributes.Cast<CommandForAttribute>().Any(attribute => attribute.CommandName.IsEqualTo(config.CommandName));
}).FirstOrDefault();
if (command == null)
{
//todo: #2581 add a search among other location/extensions for the command
if (!string.IsNullOrWhiteSpace(config.CommandName))
{
throw new Exception(@"Could not find a command registered that meets '{0}'.
Try choco --help for command reference/help.".FormatWith(config.CommandName));
}
if (isConsole)
{
Environment.ExitCode = 1;
}
}
else
{
if (parseArgs != null)
{
parseArgs.Invoke(command);
}
if (command.MayRequireAdminAccess())
{
WarnIfAdminAndNeedsElevation(config);
View on GitHub (pinned to 0d5abdd10c)
Solutions
- Check spelling: run 'choco --help' for the full list of available commands
- Verify the command exists in your Chocolatey version (some commands require extensions or licensed editions)
- If using a custom extension command, ensure the extension is installed and registered
- Update scripts if a command was renamed in a newer Chocolatey version
Example fix
// before choco instal mypackage // after choco install mypackage
Defensive patterns
Strategy: validation
Validate before calling
// Validate command name before execution
var knownCommands = new[] { "install", "upgrade", "uninstall", "list", "search",
"push", "pack", "new", "source", "config", "feature", "pin", "outdated", "apikey", "info", "template", "export", "help" };
if (!knownCommands.Contains(commandName.ToLowerInvariant()))
{
Console.Error.WriteLine($"Unknown command '{commandName}'. Run 'choco --help' for available commands.");
} Try / catch
try
{
runner.Run(config, container, isConsole, parseArgs);
}
catch (Exception ex) when (ex.Message.Contains("Could not find a command"))
{
logger.Error($"Unknown command '{config.CommandName}'. Run 'choco --help' for the command list.");
Environment.Exit(1);
} Prevention
- Run 'choco --help' to see all available commands
- Double-check command spelling in scripts and automation
- Be aware that some commands require licensed editions or extensions
- Use tab-completion in interactive shells to avoid typos
When it happens
Trigger: Running 'choco instal pkg' (typo in 'install'). Running 'choco deploy pkg' where 'deploy' is not a built-in command. A custom command extension was expected but not registered in the container. Case sensitivity mismatch if IsEqualTo fails (though it is case-insensitive). Running a v3-only command on a v2 build or vice versa.
Common situations: Typo or misspelling in the command name. User expects a command from a Chocolatey extension or licensed edition that isn't installed. Command was renamed or removed in a version upgrade. Autocomplete or script passes a wrong command string.
Related errors
- Package name is required. Please pass at least one package n
- Force dependencies can only be used with force also turned o
- It appears you are attempting to use options that may be onl
- A value was passed to the `-v` option, but this option does
- The implementation of '{0}' does not support listing '{1}'
AI-assisted analysis of chocolatey/choco@0d5abdd10c (2026-08-13).
Data as JSON: /api/errors/023b4b846d662dbd.
Report an issue: GitHub.