{"record":{"id":"823d76255144e483","repo":"chocolatey/choco","slug":"the-0-source-does-not-support-listing-of-packa","errorCode":null,"errorMessage":"The '{0}' source does not support listing of packages","messagePattern":"The '(.+?)' source does not support listing of packages","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs","lineNumber":281,"sourceCode":"            IEnumerable<PackageResult> results;\r\n\r\n            if (config.ListCommand.LocalOnly && !config.SourceType.IsEqualTo(SourceTypes.Normal))\r\n            {\r\n                results = PerformSourceRunnerFunction<IListSourceRunner, IEnumerable<PackageResult>>(config, runner => runner.List(config));\r\n            }\r\n            else if (config.SourceType.IsEqualTo(SourceTypes.Normal))\r\n            {\r\n                results = _nugetService.List(config).OrEmpty();\r\n            }\r\n            else\r\n            {\r\n                results = PerformSourceRunnerFunction<ISearchableSourceRunner, IEnumerable<PackageResult>>(config, runner => runner.Search(config));\r\n            }\r\n\r\n            if (results is null)\r\n            {\r\n                var message = config.ListCommand.LocalOnly ? \"The '{0}' source does not support listing of packages\".FormatWith(config.SourceType) : \"The '{0}' source does not support searching for packages\".FormatWith(config.SourceType);\r\n                throw new NotSupportedException(message);\r\n            }\r\n\r\n            foreach (PackageResult package in results)\r\n            {\r\n                if (config.SourceType.IsEqualTo(SourceTypes.Normal))\r\n                {\r\n                    if (!config.ListCommand.IncludeRegistryPrograms)\r\n                    {\r\n                        yield return package;\r\n                    }\r\n\r\n                    if (config.ListCommand.LocalOnly && config.ListCommand.IncludeRegistryPrograms && package.PackageMetadata != null)\r\n                    {\r\n                        packages.Add(package);\r\n                    }\r\n                }\r\n            }\r\n\r","sourceCodeStart":263,"sourceCodeEnd":299,"githubUrl":"https://github.com/chocolatey/choco/blob/0d5abdd10cc177a141e69547cad6935b419b6c17/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs#L263-L299","documentation":"Thrown by ChocolateyPackageService.List when the results from the source resolution are null, indicating the source type does not support listing or searching of packages. For normal sources, _nugetService.List is called; for alternative sources, PerformSourceRunnerFunction<ISearchableSourceRunner> is called. If results is null after both paths, the source lacks listing/search capability. The message differs based on whether LocalOnly mode is set (listing vs searching wording).","triggerScenarios":"Using a source type that doesn't implement ISearchableSourceRunner for 'choco search' or 'choco list'. The NuGet service List returns null due to an internal error or misconfiguration. An alternative source runner is found but its Search method returns null instead of an empty enumerable. config.ListCommand.LocalOnly is true and the source type doesn't support local listing.","commonSituations":"User runs 'choco list --source-type=<unsupported>' where the source type handles installs but not listing. Misconfigured source where the NuGet service fails silently and returns null. Source runner extension is partially functional (installs work, search doesn't). User expects all source types to be searchable.","solutions":["Use 'choco list' or 'choco search' without --source-type to query the default NuGet source","Verify the source type supports listing/searching by checking its documentation","For local-only listing, use 'choco list --local-only' which queries installed packages","Ensure the source runner extension is fully functional and implements ISearchableSourceRunner"],"exampleFix":"// before\nchoco search mypackage --source-type=windowsfeatures\n// throws: The 'windowsfeatures' source does not support searching for packages\n\n// after (use default source for search)\nchoco search mypackage\n// or use the appropriate command for that source type:\nchoco list --source-type=windowsfeatures","handlingStrategy":"validation","validationCode":"// Validate source type supports listing before calling List\nif (!config.SourceType.IsEqualTo(SourceTypes.Normal))\n{\n    var runner = GetSourceRunner(config.SourceType);\n    if (!(runner is ISearchableSourceRunner))\n    {\n        Console.Error.WriteLine($\"Source '{config.SourceType}' does not support listing/searching.\");\n        return;\n    }\n}","typeGuard":"public static bool SourceSupportsListing(string sourceType, IEnumerable<IAlternativeSourceRunner> runners)\n{\n    if (sourceType.IsEqualTo(SourceTypes.Normal)) return true;\n    var runner = runners.FirstOrDefault(r => GetSourceRunnerType(r) == sourceType);\n    return runner is ISearchableSourceRunner;\n}","tryCatchPattern":"try\n{\n    var results = packageService.List(config).ToList();\n}\ncatch (NotSupportedException ex) when (ex.Message.Contains(\"does not support listing\") ||\n                                        ex.Message.Contains(\"does not support searching\"))\n{\n    logger.Error($\"Source '{config.SourceType}' cannot list/search. Use the default NuGet source.\");\n    return new List<PackageResult>();\n}","preventionTips":["Use 'choco list' or 'choco search' without --source-type for standard package queries","Verify the source type supports listing before using it with search/list commands","For local-only queries, use 'choco list --local-only' which doesn't need a searchable source","Understand that not all source types implement ISearchableSourceRunner"],"tags":["source","listing","search","not-supported","alternative-source","source-type"],"backgroundTag":null,"analyzedSha":"0d5abdd10cc177a141e69547cad6935b419b6c17","analyzedAt":"2026-08-13T18:33:03.301Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}