{"record":{"id":"3979f7eb96a00dbd","repo":"chocolatey/choco","slug":"the-implementation-of-0-does-not-support-listi","errorCode":null,"errorMessage":"The implementation of '{0}' does not support listing '{1}'","messagePattern":"The implementation of '(.+?)' does not support listing '(.+?)'","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/chocolatey/infrastructure.app/runners/GenericRunner.cs","lineNumber":277,"sourceCode":"        {\r\n            var tasks = container.GetAllInstances<ITask>();\r\n            foreach (var task in tasks)\r\n            {\r\n                task.Initialize();\r\n            }\r\n\r\n            FailOnMissingOrInvalidLicenseIfFeatureSet(config);\r\n            HttpsSecurity.Reset();\r\n            EventManager.Publish(new PreRunMessage(config));\r\n\r\n            try\r\n            {\r\n                var command = FindCommand(config, container, isConsole, parseArgs) as IListCommand<T>;\r\n                if (command == null)\r\n                {\r\n                    if (!string.IsNullOrWhiteSpace(config.CommandName))\r\n                    {\r\n                        throw new Exception(\"The implementation of '{0}' does not support listing '{1}'\".FormatWith(config.CommandName, typeof(T).Name));\r\n                    }\r\n                    return new List<T>();\r\n                }\r\n                else\r\n                {\r\n                    this.Log().Debug(\"_ {0}:{1} - Normal List Mode _\".FormatWith(ApplicationParameters.Name, command.GetType().Name));\r\n                    return command.List(config);\r\n                }\r\n            }\r\n            finally\r\n            {\r\n                EventManager.Publish(new PostRunMessage(config));\r\n\r\n                foreach (var task in tasks.OrEmpty())\r\n                {\r\n                    task.Shutdown();\r\n                }\r\n\r","sourceCodeStart":259,"sourceCodeEnd":295,"githubUrl":"https://github.com/chocolatey/choco/blob/0d5abdd10cc177a141e69547cad6935b419b6c17/src/chocolatey/infrastructure.app/runners/GenericRunner.cs#L259-L295","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the command actually supports IListCommand<T> for the specific type T being requested","Check that the correct command name is being used for the listing operation","Ensure licensed extensions that provide listing capability are properly installed and registered","Use the non-generic list path if the command only implements IListCommand without type parameters"],"exampleFix":"// before: command doesn't implement IListCommand<PackageResult>\nrunner.List<PackageResult>(config, container, isConsole, parseArgs);\n\n// after: use the non-generic list method or ensure the command implements the interface\nrunner.List(config, container, isConsole, parseArgs);","handlingStrategy":"type-guard","validationCode":"// Check command capability before calling List<T>\nvar command = FindCommand(config, container, isConsole, parseArgs);\nif (command is IListCommand<T> listCommand)\n{\n    return listCommand.List(config);\n}\nelse\n{\n    logger.Warn($\"Command '{config.CommandName}' does not support IListCommand<{typeof(T).Name}>\");\n    return new List<T>();\n}","typeGuard":"public static bool SupportsTypedList<T>(ICommand command)\n{\n    return command is IListCommand<T>;\n}","tryCatchPattern":"try\n{\n    var results = runner.List<PackageResult>(config, container, isConsole, parseArgs);\n}\ncatch (Exception ex) when (ex.Message.Contains(\"does not support listing\"))\n{\n    logger.Error($\"Command '{config.CommandName}' cannot list {typeof(T).Name}. Use a listing-capable command.\");\n    return Enumerable.Empty<T>();\n}","preventionTips":["Verify a command implements IListCommand<T> before calling the generic List method","Use the non-generic List overload if the command only implements IListCommand","Ensure licensed extensions that provide listing are properly installed","Check command capabilities at the API boundary before routing to generic methods"],"tags":["command-resolution","interface-mismatch","listing","generics","internal-api"],"backgroundTag":null,"analyzedSha":"0d5abdd10cc177a141e69547cad6935b419b6c17","analyzedAt":"2026-08-13T18:33:03.301Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}