chocolatey/choco · error · NotSupportedException
The '{0}' source does not support listing of packages
Error message
The '{0}' source does not support listing of packages What it means
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).
Source
Thrown at src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs:281
IEnumerable<PackageResult> results;
if (config.ListCommand.LocalOnly && !config.SourceType.IsEqualTo(SourceTypes.Normal))
{
results = PerformSourceRunnerFunction<IListSourceRunner, IEnumerable<PackageResult>>(config, runner => runner.List(config));
}
else if (config.SourceType.IsEqualTo(SourceTypes.Normal))
{
results = _nugetService.List(config).OrEmpty();
}
else
{
results = PerformSourceRunnerFunction<ISearchableSourceRunner, IEnumerable<PackageResult>>(config, runner => runner.Search(config));
}
if (results is null)
{
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);
throw new NotSupportedException(message);
}
foreach (PackageResult package in results)
{
if (config.SourceType.IsEqualTo(SourceTypes.Normal))
{
if (!config.ListCommand.IncludeRegistryPrograms)
{
yield return package;
}
if (config.ListCommand.LocalOnly && config.ListCommand.IncludeRegistryPrograms && package.PackageMetadata != null)
{
packages.Add(package);
}
}
}
View on GitHub (pinned to 0d5abdd10c)
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
Example fix
// before choco search mypackage --source-type=windowsfeatures // throws: The 'windowsfeatures' source does not support searching for packages // after (use default source for search) choco search mypackage // or use the appropriate command for that source type: choco list --source-type=windowsfeatures
Defensive patterns
Strategy: validation
Validate before calling
// Validate source type supports listing before calling List
if (!config.SourceType.IsEqualTo(SourceTypes.Normal))
{
var runner = GetSourceRunner(config.SourceType);
if (!(runner is ISearchableSourceRunner))
{
Console.Error.WriteLine($"Source '{config.SourceType}' does not support listing/searching.");
return;
}
} Type guard
public static bool SourceSupportsListing(string sourceType, IEnumerable<IAlternativeSourceRunner> runners)
{
if (sourceType.IsEqualTo(SourceTypes.Normal)) return true;
var runner = runners.FirstOrDefault(r => GetSourceRunnerType(r) == sourceType);
return runner is ISearchableSourceRunner;
} Try / catch
try
{
var results = packageService.List(config).ToList();
}
catch (NotSupportedException ex) when (ex.Message.Contains("does not support listing") ||
ex.Message.Contains("does not support searching"))
{
logger.Error($"Source '{config.SourceType}' cannot list/search. Use the default NuGet source.");
return new List<PackageResult>();
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- No runner was found that implements source type '{0}' or, it
- No runner was found that implements source type '{0}' or act
- When using the '--source' option with the 'choco list' comma
- The '{0}' source does not support searching for packages
- You must specify 'source' to remove an API key.
AI-assisted analysis of chocolatey/choco@0d5abdd10c (2026-08-13).
Data as JSON: /api/errors/823d76255144e483.
Report an issue: GitHub.