chocolatey/choco · error · NotSupportedException
The '{0}' source does not support uninstalling packages
Error message
The '{0}' source does not support uninstalling packages What it means
Thrown as a NotSupportedException when an uninstall operation against a non-normal source type returns null results. PerformSourceRunnerFunction<IUninstallSourceRunner> is called for alternative sources; if no runner implementing IUninstallSourceRunner is registered for the given SourceType, it returns default (null) and this exception fires.
Source
Thrown at src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs:1267
var environmentBefore = GetInitialEnvironment(config);
ConcurrentDictionary<string, PackageResult> results;
if (config.SourceType.IsEqualTo(SourceTypes.Normal))
{
var action = new Action<PackageResult, ChocolateyConfiguration>(HandlePackageUninstall);
var beforeUninstallAction = new Action<PackageResult, ChocolateyConfiguration>(BeforeModifyAction);
results = _nugetService.Uninstall(config, action, beforeUninstallAction);
}
else
{
results = PerformSourceRunnerFunction<IUninstallSourceRunner, ConcurrentDictionary<string, PackageResult>>(config, runner => runner.Uninstall(config, null));
}
if (results is null)
{
throw new NotSupportedException("The '{0}' source does not support uninstalling packages".FormatWith(config.SourceType));
}
foreach (var result in results)
{
packageUninstalls.GetOrAdd(result.Key, result.Value);
}
// not handled in the uninstall handler
IEnumerable<GenericRegistryValue> environmentChanges;
IEnumerable<GenericRegistryValue> environmentRemovals;
LogEnvironmentChanges(config, environmentBefore, out environmentChanges, out environmentRemovals);
}
finally
{
var actionSummaryResult = ReportActionSummary(packageUninstalls, "uninstalled");
if (actionSummaryResult.Failures != 0 && Environment.ExitCode == 0)
{
Environment.ExitCode = 1;
View on GitHub (pinned to 0d5abdd10c)
Solutions
- Verify the alternative source runner implements IUninstallSourceRunner for your source type.
- For normal packages, do not set an alternative source type — uninstall uses the local package metadata store.
- For custom runners, implement IUninstallSourceRunner and register the runner in the DI container.
- If the source type does not support uninstall, remove the package through its native tool instead.
Example fix
// before: runner lacks uninstall interface
public class MyRunner : IAlternativeSourceRunner, IInstallSourceRunner { }
// after: add uninstall support
public class MyRunner : IAlternativeSourceRunner, IInstallSourceRunner, IUninstallSourceRunner
{
public ConcurrentDictionary<string, PackageResult> Uninstall(
ChocolateyConfiguration config,
Action<PackageResult, ChocolateyConfiguration> continueAction,
Action<PackageResult, ChocolateyConfiguration> beforeUninstallAction)
{
return new ConcurrentDictionary<string, PackageResult>();
}
} Defensive patterns
Strategy: validation
Validate before calling
// Verify a runner implementing IUninstallSourceRunner exists for the source type
if (!config.SourceType.IsEqualTo(SourceTypes.Normal))
{
var runners = _containerResolver.ResolveAll<IUninstallSourceRunner>();
if (!runners.Any(r => r.SourceType.IsEqualTo(config.SourceType)))
{
throw new InvalidOperationException($"No uninstall runner registered for source type '{config.SourceType}'.");
}
} Type guard
public static bool SourceTypeSupportsUninstall(string sourceType, IEnumerable<IAlternativeSourceRunner> registeredRunners)
{
if (sourceType.IsEqualTo(SourceTypes.Normal)) return true;
return registeredRunners.OfType<IUninstallSourceRunner>().Any(r => r.SourceType.IsEqualTo(sourceType));
} Try / catch
try
{
_packageService.Uninstall(config);
}
catch (NotSupportedException ex) when (ex.Message.Contains("does not support uninstalling"))
{
logger.Error($"Source type '{config.SourceType}' does not support uninstall. Use native tool or 'normal' source type.");
} Prevention
- Check whether the alternative source runner implements IUninstallSourceRunner.
- For normal packages, leave SourceType as 'normal' — uninstall works against local metadata.
- If the source does not support uninstall, remove the package through its native tool.
When it happens
Trigger: Calling Uninstall with config.SourceType set to a non-normal value when no alternative source runner implementing IUninstallSourceRunner is registered. The null-check on results after the runner function call triggers the throw.
Common situations: Running 'choco uninstall pkg --source-type python' where the Python source runner does not implement IUninstallSourceRunner. Alternative source runners commonly support install but not uninstall.
Related errors
- The '{0}' source does not support searching for packages
- The '{0}' source does not support installing packages
- The '{0}' source does not support upgrading packages
- {0} {1} not successful.
- Alternative sources do not allow the use of the 'all' packag
AI-assisted analysis of chocolatey/choco@0d5abdd10c (2026-08-13).
Data as JSON: /api/errors/46a81344e8543447.
Report an issue: GitHub.