chocolatey/choco · error · NotSupportedException

The '{0}' source does not support installing packages

Error message

The '{0}' source does not support installing packages

What it means

Thrown as a NotSupportedException when an install operation against a non-normal source type returns null results. The code delegates to PerformSourceRunnerFunction<IInstallSourceRunner> for alternative sources; if no runner implementing IInstallSourceRunner is registered for the given SourceType, the function returns default (null), triggering this exception.

Source

Thrown at src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs:804

                foreach (var packageConfig in GetConfigFromInputAndPackageConfigInput(config, packageInstalls, installSourceRunners).OrEmpty())
                {
                    ConcurrentDictionary<string, PackageResult> results;

                    if (packageConfig.SourceType.IsEqualTo(SourceTypes.Normal))
                    {
                        var action = new Action<PackageResult, ChocolateyConfiguration>((packageResult, configuration) => HandlePackageResult(packageResult, configuration, CommandNameType.Install));
                        var beforeModifyAction = new Action<PackageResult, ChocolateyConfiguration>((packageResult, configuration) => BeforeModifyAction(packageResult, configuration));

                        results = _nugetService.Install(packageConfig, action, beforeModifyAction);
                    }
                    else
                    {
                        results = PerformSourceRunnerFunction<IInstallSourceRunner, ConcurrentDictionary<string, PackageResult>>(packageConfig, runner => runner.Install(packageConfig, null));
                    }

                    if (results is null)
                    {
                        throw new NotSupportedException("The '{0}' source does not support installing packages".FormatWith(config.SourceType));
                    }

                    foreach (var result in results)
                    {
                        packageInstalls.GetOrAdd(result.Key, result.Value);
                    }
                }
            }
            finally
            {
                var actionSummaryResult = ReportActionSummary(packageInstalls, "installed");
                if (actionSummaryResult.Failures != 0 && Environment.ExitCode == 0)
                {
                    Environment.ExitCode = 1;
                }

                RandomlyNotifyAboutLicensedFeatures(config);
            }

View on GitHub (pinned to 0d5abdd10c)

Solutions

  1. Verify the --source-type value matches a registered runner that implements IInstallSourceRunner.
  2. If installing from a normal feed, do not set config.SourceType to an alternative type — leave it as 'normal'.
  3. For custom runners, implement IInstallSourceRunner and register the runner class in the DI container.
  4. Check that the source type string is spelled correctly and matches a constant in SourceTypes.

Example fix

// before: custom runner missing install interface
public class MyRunner : IAlternativeSourceRunner { }

// after: implement IInstallSourceRunner
public class MyRunner : IAlternativeSourceRunner, IInstallSourceRunner
{
    public ConcurrentDictionary<string, PackageResult> Install(
        ChocolateyConfiguration config,
        Action<PackageResult, ChocolateyConfiguration> continueAction,
        Action<PackageResult, ChocolateyConfiguration> beforeModifyAction)
    {
        return new ConcurrentDictionary<string, PackageResult>();
    }
}
Defensive patterns

Strategy: validation

Validate before calling

// Verify a runner implementing IInstallSourceRunner exists for the source type
if (!config.SourceType.IsEqualTo(SourceTypes.Normal))
{
    var runners = _containerResolver.ResolveAll<IInstallSourceRunner>();
    if (!runners.Any(r => r.SourceType.IsEqualTo(config.SourceType)))
    {
        throw new InvalidOperationException($"No install runner registered for source type '{config.SourceType}'.");
    }
}

Type guard

public static bool SourceTypeSupportsInstall(string sourceType, IEnumerable<IAlternativeSourceRunner> registeredRunners)
{
    if (sourceType.IsEqualTo(SourceTypes.Normal)) return true;
    return registeredRunners.OfType<IInstallSourceRunner>().Any(r => r.SourceType.IsEqualTo(sourceType));
}

Try / catch

try
{
    var results = _packageService.Install(config);
}
catch (NotSupportedException ex) when (ex.Message.Contains("does not support installing"))
{
    logger.Error($"Source type '{config.SourceType}' does not support install. Use 'normal' source type.");
}

Prevention

When it happens

Trigger: Calling Install on ChocolateyPackageService with config.SourceType set to a non-normal value (e.g., 'python', 'ruby', 'cygwin', 'windowsfeatures') when no alternative source runner implementing IInstallSourceRunner is registered in the container for that source type.

Common situations: Using a source type that does not support installation (e.g., a read-only or list-only source), or a custom source runner that lacks the IInstallSourceRunner interface. Also triggered when a source type string is misspelled or refers to an unregistered runner.

Related errors


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