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

RubyGemsService.EnsureSourceAppRegistered throws NotImplementedException on non-Windows platforms. The Ruby (gem) source type is supported only on Windows, so initialization fails fast elsewhere.

Source

Thrown at src/chocolatey/infrastructure.app/services/RubyGemsService.cs:121

            args.Add("Version", new ExternalCommandArgument
            {
                ArgumentOption = "--version ",
                QuoteValue = false,
                Required = false
            });
        }

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

        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");
            }

            var runnerConfig = new ChocolateyConfiguration
            {
                PackageNames = RubyPortalPackage,
                Sources = ApplicationParameters.PackagesLocation,
                Debug = config.Debug,
                Force = config.Force,
                Verbose = config.Verbose,
                CommandExecutionTimeoutSeconds = config.CommandExecutionTimeoutSeconds,
                CacheLocation = config.CacheLocation,
                RegularOutput = config.RegularOutput,
                PromptForConfirmation = false,
                AcceptLicense = true,
                QuietOutput = true,
            };
            runnerConfig.ListCommand.LocalOnly = true;

View on GitHub (pinned to 0d5abdd10c)

Solutions

  1. Run Ruby-source commands on a Windows host only
  2. Manage gems with the gem CLI directly on non-Windows systems
  3. Guard Ruby-source commands on platform before invoking them

Example fix

// before
choco install rails --source=ruby  # on Linux
// after
# on non-Windows, use gem directly:
gem install rails
Defensive patterns

Strategy: type-guard

Validate before calling

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

Type guard

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

Prevention

When it happens

Trigger: Using the Ruby source (--source ruby / SourceTypes.Ruby) on Linux or macOS where Platform.GetPlatform() != PlatformType.Windows, when the source is ensured/initialized.

Common situations: Running Chocolatey CLI on non-Windows to manage gems; cross-platform scripts assuming Windows; CI matrix with non-Windows nodes.

Related errors


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