{"record":{"id":"e78b502f7d51ab96","repo":"chocolatey/choco","slug":"this-source-is-not-supported-on-non-windows-system","errorCode":null,"errorMessage":"This source is not supported on non-Windows systems","messagePattern":"This source is not supported on non-Windows systems","errorType":"exception","errorClass":"NotImplementedException","httpStatus":null,"severity":"error","filePath":"src/chocolatey/infrastructure.app/services/CygwinService.cs","lineNumber":146,"sourceCode":"            args.Add(\"_package_name_\", new ExternalCommandArgument\r\n            {\r\n                ArgumentOption = \"--packages \",\r\n                ArgumentValue = PackageNameToken,\r\n                QuoteValue = false,\r\n                Required = true\r\n            });\r\n        }\r\n\r\n        public string SourceType\r\n        {\r\n            get { return SourceTypes.Cygwin; }\r\n        }\r\n\r\n        public void EnsureSourceAppInstalled(ChocolateyConfiguration config, Action<PackageResult, ChocolateyConfiguration> ensureAction)\r\n        {\r\n            if (Platform.GetPlatform() != PlatformType.Windows)\r\n            {\r\n                throw new NotImplementedException(\"This source is not supported on non-Windows systems\");\r\n            }\r\n\r\n            var runnerConfig = new ChocolateyConfiguration\r\n            {\r\n                Sources = ApplicationParameters.PackagesLocation,\r\n                Debug = config.Debug,\r\n                Force = config.Force,\r\n                Verbose = config.Verbose,\r\n                CommandExecutionTimeoutSeconds = config.CommandExecutionTimeoutSeconds,\r\n                CacheLocation = config.CacheLocation,\r\n                RegularOutput = config.RegularOutput,\r\n                PromptForConfirmation = false,\r\n                AcceptLicense = true,\r\n                QuietOutput = true,\r\n            };\r\n            runnerConfig.ListCommand.LocalOnly = true;\r\n\r\n            var localPackages = _nugetService.List(runnerConfig);\r","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/chocolatey/choco/blob/0d5abdd10cc177a141e69547cad6935b419b6c17/src/chocolatey/infrastructure.app/services/CygwinService.cs#L128-L164","documentation":"Thrown as a NotImplementedException in CygwinService.EnsureSourceAppInstalled when Platform.GetPlatform() does not return PlatformType.Windows. The Cygwin source type relies on Windows-specific executables and APIs (the Cygwin setup.exe) that do not exist on Linux or macOS, making the entire source non-functional on non-Windows platforms.","triggerScenarios":"Any Cygwin source operation (install, list, search) triggers EnsureSourceAppInstalled as part of the bootstrappable source runner check. If Chocolatey is running on Linux or macOS and config.SourceType is 'cygwin', this exception is thrown before any Cygwin command executes.","commonSituations":"Running Chocolatey on WSL, Linux containers, or macOS with a Cygwin source configured. Also occurs in CI/CD pipelines that use Linux runners but have Cygwin source references in configuration. Cygwin is inherently a Windows-only compatibility layer.","solutions":["Run Chocolatey with Cygwin sources only on Windows hosts.","Use the 'normal' source type or a platform-appropriate alternative source on non-Windows systems.","In CI/CD, ensure Windows-based runners are used for any Cygwin source operations.","Remove or disable Cygwin sources in config when targeting cross-platform execution."],"exampleFix":"// before: attempting Cygwin on non-Windows\nchoco install bash --source-type=cygwin  # on Linux/macOS\n\n// after: run on Windows, or use a different source type\n// On Windows:\nchoco install bash --source-type=cygwin\n// On Linux: use the system package manager (apt, dnf) instead","handlingStrategy":"validation","validationCode":"// Before any Cygwin source operation, verify the platform\nif (config.SourceType.IsEqualTo(SourceTypes.Cygwin) && Platform.GetPlatform() != PlatformType.Windows)\n{\n    throw new PlatformNotSupportedException(\n        \"Cygwin source type is only supported on Windows. Use 'normal' source type on this platform.\");\n}","typeGuard":"public static bool IsCygwinSupportedOnCurrentPlatform()\n{\n    return Platform.GetPlatform() == PlatformType.Windows;\n}","tryCatchPattern":"try\n{\n    _cygwinService.EnsureSourceAppInstalled(config, action);\n}\ncatch (NotImplementedException ex) when (ex.Message.Contains(\"not supported on non-Windows\"))\n{\n    logger.Error(\"Cygwin source requires Windows. Switch to a compatible source type for this platform.\");\n}","preventionTips":["Only configure Cygwin sources on Windows hosts.","In cross-platform CI/CD pipelines, gate Cygwin operations behind a Windows platform check.","Use 'normal' source type or platform-native package managers on Linux/macOS.","Test source configurations on the target platform before deployment."],"tags":["cygwin","platform","non-windows","notimplemented","chocolatey"],"backgroundTag":null,"analyzedSha":"0d5abdd10cc177a141e69547cad6935b419b6c17","analyzedAt":"2026-08-13T18:33:03.301Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}