chocolatey/choco · error · NotSupportedException

No runner was found that implements source type '{0}' or act

Error message

No runner was found that implements source type '{0}' or action was missing

What it means

Thrown by ChocolateyPackageService.PerformSourceRunnerAction (the action overload) when GetSourceRunner returns null for the given config.SourceType (no registered IAlternativeSourceRunner matches) or when the action delegate itself is null, and throwOnException is true. This covers source types like 'ruby', 'python', 'cygwin', 'windowsfeatures', etc. that require specialized runners. If the appropriate runner isn't registered in the DI container, the operation cannot proceed.

Source

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

        private void PerformSourceRunnerAction<TSourceRunner>(ChocolateyConfiguration config, Action<TSourceRunner> action, IEnumerable<TSourceRunner> alternativeSourceRunners, bool throwOnException = false)
            where TSourceRunner : class, IAlternativeSourceRunner
        {
            var runner = GetSourceRunner(config.SourceType, alternativeSourceRunners);
            if (runner != null && action != null)
            {
                if (runner is IBootstrappableSourceRunner bootstrapper)
                {
                    bootstrapper.EnsureSourceAppInstalled(config, (packageResult, configuration) => HandlePackageResult(packageResult, configuration, CommandNameType.Install));
                }

                action.Invoke(runner);
            }
            else
            {
                if (throwOnException)
                {
                    throw new NotSupportedException("No runner was found that implements source type '{0}' or action was missing".FormatWith(config.SourceType));
                }
                else
                {
                    this.Log().Warn("No runner was found that implements source type '{0}' or action was missing".FormatWith(config.SourceType));
                }
            }
        }

        private TResult PerformSourceRunnerFunction<TSourceRunner, TResult>(ChocolateyConfiguration config, Func<TSourceRunner, TResult> function, bool throwOnException = false)
            where TSourceRunner : class, IAlternativeSourceRunner
        {
            var alternativeSourceRunners = _containerResolver.ResolveAll<TSourceRunner>();
            return PerformSourceRunnerFunction(config, function, alternativeSourceRunners, throwOnException);
        }

        private TResult PerformSourceRunnerFunction<TSourceRunner, TResult>(ChocolateyConfiguration config, Func<TSourceRunner, TResult> function, IEnumerable<TSourceRunner> alternativeSourceRunners, bool throwOnException = false)
            where TSourceRunner : class, IAlternativeSourceRunner
        {

View on GitHub (pinned to 0d5abdd10c)

Solutions

  1. Verify the source type name with 'choco search --help' or documentation for supported source types
  2. Install the Chocolatey extension that provides the needed source runner
  3. Check spelling of the --source-type argument
  4. Use the default/normal source type if the specialized one isn't needed: omit --source-type

Example fix

// before
choco install mypackage --source=python --source-type=python
// throws if python runner not installed

// after (use normal source)
choco install mypackage --source=https://pypi.org/
// or install the python extension first, then:
choco install mypackage --source-type=python
Defensive patterns

Strategy: validation

Validate before calling

// Validate source type has a registered runner before performing operations
var supportedSourceTypes = new[] { "normal", "ruby", "python", "cygwin", "windowsfeatures", "webpi" };
if (!supportedSourceTypes.Contains(sourceType.ToLowerInvariant()))
{
    Console.Error.WriteLine($"Source type '{sourceType}' has no registered runner. " +
        "Supported types: {string.Join(", ", supportedSourceTypes)}");
    return;
}

Type guard

public static bool IsKnownSourceType(string sourceType, IEnumerable<string> registeredTypes)
{
    return registeredTypes.Any(t => t.Equals(sourceType, StringComparison.OrdinalIgnoreCase));
}

Try / catch

try
{
    packageService.InstallPackage(config);
}
catch (NotSupportedException ex) when (ex.Message.Contains("No runner was found"))
{
    logger.Error($"No source runner for type '{config.SourceType}'. " +
        "Install the required extension or use the default source.");
}

Prevention

When it happens

Trigger: Setting --source-type to a value like 'ruby' or 'windowsfeatures' when no corresponding runner is registered. The runner extension or module providing the source type is not installed. The source type string has a typo. The action parameter passed to the method is null (internal code error). throwOnException is true (called from a path that expects exceptions).

Common situations: User passes --source-type=python but the Python source runner extension isn't installed. Chocolatey extension that provides the source runner is missing or corrupted. Typo in source type name. Version mismatch where the runner was removed or renamed. Internal call passes null action due to a bug.

Related errors


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