chocolatey/choco · error · NotImplementedException

This source is not supported on non-Windows systems

Error message

This source is not supported on non-Windows systems

What it means

WindowsFeatureService.EnsureSourceAppRegistered throws NotImplementedException on non-Windows platforms. The Windows Features source (DISM/servicing backed) is inherently Windows-only, so initialization fails fast on other OSes.

Source

Thrown at src/chocolatey/infrastructure.app/services/WindowsFeatureService.cs:163

                ArgumentOption = "/LogLevel=",
                ArgumentValue = LogLevelToken,
                QuoteValue = false,
                Required = true
            });

            args.Add("_no_restart_", new ExternalCommandArgument { ArgumentOption = "/NoRestart", Required = true });
        }

        public string SourceType
        {
            get { return SourceTypes.WindowsFeatures; }
        }

        public void EnsureSourceAppInstalled(ChocolateyConfiguration config, Action<PackageResult, ChocolateyConfiguration> ensureAction)
        {
            if (Platform.GetPlatform() != PlatformType.Windows)
            {
                throw new NotImplementedException("This source is not supported on non-Windows systems");
            }

            EnsureExecutablePathSet();
        }

        private void EnsureExecutablePathSet()
        {
            if (!string.IsNullOrWhiteSpace(_exePath))
            {
                return;
            }

            foreach (var location in _exeLocations)
            {
                if (_fileSystem.FileExists(location))
                {
                    _exePath = location;
                    break;

View on GitHub (pinned to 0d5abdd10c)

Solutions

  1. Run WindowsFeatures-source commands on a Windows host only
  2. Guard the command on platform before invoking it
  3. Use a native package manager on non-Windows instead

Example fix

// before
choco list --source=windowsfeatures  # on Linux
// after
# run on Windows, or guard:
if ($IsWindows) { choco list --source=windowsfeatures }
Defensive patterns

Strategy: type-guard

Validate before calling

if (Platform.GetPlatform() != PlatformType.Windows) {
    Console.Error.WriteLine("windowsfeatures source is Windows-only.");
    return;
}

Type guard

static bool IsWindowsFeaturesSourceSupported() => Platform.GetPlatform() == PlatformType.Windows;

Prevention

When it happens

Trigger: Using the Windows Features source (--source windowsfeatures / SourceTypes.WindowsFeatures) on Linux or macOS where Platform.GetPlatform() != PlatformType.Windows.

Common situations: Cross-platform scripts that call the windowsfeatures source unconditionally; CI matrix including non-Windows nodes; misconfigured source on a Linux runner.

Related errors


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