chocolatey/choco · error · Exception

The implementation of '{0}' does not support listing '{1}'

Error message

The implementation of '{0}' does not support listing '{1}'

What it means

Thrown by GenericRunner.List<T> when the resolved command does not implement IListCommand<T>. The generic list method expects the command (found by name) to support listing operations for the specific type T. If the command exists but is not castable to IListCommand<T>, it cannot perform the typed list operation. This typically indicates a mismatch between the requested list operation and the command's capabilities.

Source

Thrown at src/chocolatey/infrastructure.app/runners/GenericRunner.cs:277

        {
            var tasks = container.GetAllInstances<ITask>();
            foreach (var task in tasks)
            {
                task.Initialize();
            }

            FailOnMissingOrInvalidLicenseIfFeatureSet(config);
            HttpsSecurity.Reset();
            EventManager.Publish(new PreRunMessage(config));

            try
            {
                var command = FindCommand(config, container, isConsole, parseArgs) as IListCommand<T>;
                if (command == null)
                {
                    if (!string.IsNullOrWhiteSpace(config.CommandName))
                    {
                        throw new Exception("The implementation of '{0}' does not support listing '{1}'".FormatWith(config.CommandName, typeof(T).Name));
                    }
                    return new List<T>();
                }
                else
                {
                    this.Log().Debug("_ {0}:{1} - Normal List Mode _".FormatWith(ApplicationParameters.Name, command.GetType().Name));
                    return command.List(config);
                }
            }
            finally
            {
                EventManager.Publish(new PostRunMessage(config));

                foreach (var task in tasks.OrEmpty())
                {
                    task.Shutdown();
                }

View on GitHub (pinned to 0d5abdd10c)

Solutions

  1. Verify the command actually supports IListCommand<T> for the specific type T being requested
  2. Check that the correct command name is being used for the listing operation
  3. Ensure licensed extensions that provide listing capability are properly installed and registered
  4. Use the non-generic list path if the command only implements IListCommand without type parameters

Example fix

// before: command doesn't implement IListCommand<PackageResult>
runner.List<PackageResult>(config, container, isConsole, parseArgs);

// after: use the non-generic list method or ensure the command implements the interface
runner.List(config, container, isConsole, parseArgs);
Defensive patterns

Strategy: type-guard

Validate before calling

// Check command capability before calling List<T>
var command = FindCommand(config, container, isConsole, parseArgs);
if (command is IListCommand<T> listCommand)
{
    return listCommand.List(config);
}
else
{
    logger.Warn($"Command '{config.CommandName}' does not support IListCommand<{typeof(T).Name}>");
    return new List<T>();
}

Type guard

public static bool SupportsTypedList<T>(ICommand command)
{
    return command is IListCommand<T>;
}

Try / catch

try
{
    var results = runner.List<PackageResult>(config, container, isConsole, parseArgs);
}
catch (Exception ex) when (ex.Message.Contains("does not support listing"))
{
    logger.Error($"Command '{config.CommandName}' cannot list {typeof(T).Name}. Use a listing-capable command.");
    return Enumerable.Empty<T>();
}

Prevention

When it happens

Trigger: Calling the generic List<T> overload with a command that only implements the non-generic IListCommand or no IListCommand at all. A command is registered for the given CommandName but does not support typed listing for the requested T. Internal API call where the wrong type parameter is used.

Common situations: Internal code path selects a command that doesn't support the specific list type. Licensed extension provides a command that should support listing but the interface isn't implemented for the requested type. Version mismatch where a newer interface contract isn't met by an older command implementation.

Related errors


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