{"record":{"id":"b65faf39312c0c37","repo":"chocolatey/choco","slug":"this-source-is-not-supported-on-non-windows-system-b65faf","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/WindowsFeatureService.cs","lineNumber":163,"sourceCode":"                ArgumentOption = \"/LogLevel=\",\r\n                ArgumentValue = LogLevelToken,\r\n                QuoteValue = false,\r\n                Required = true\r\n            });\r\n\r\n            args.Add(\"_no_restart_\", new ExternalCommandArgument { ArgumentOption = \"/NoRestart\", Required = true });\r\n        }\r\n\r\n        public string SourceType\r\n        {\r\n            get { return SourceTypes.WindowsFeatures; }\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            EnsureExecutablePathSet();\r\n        }\r\n\r\n        private void EnsureExecutablePathSet()\r\n        {\r\n            if (!string.IsNullOrWhiteSpace(_exePath))\r\n            {\r\n                return;\r\n            }\r\n\r\n            foreach (var location in _exeLocations)\r\n            {\r\n                if (_fileSystem.FileExists(location))\r\n                {\r\n                    _exePath = location;\r\n                    break;\r","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/chocolatey/choco/blob/0d5abdd10cc177a141e69547cad6935b419b6c17/src/chocolatey/infrastructure.app/services/WindowsFeatureService.cs#L145-L181","documentation":"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.","triggerScenarios":"Using the Windows Features source (--source windowsfeatures / SourceTypes.WindowsFeatures) on Linux or macOS where Platform.GetPlatform() != PlatformType.Windows.","commonSituations":"Cross-platform scripts that call the windowsfeatures source unconditionally; CI matrix including non-Windows nodes; misconfigured source on a Linux runner.","solutions":["Run WindowsFeatures-source commands on a Windows host only","Guard the command on platform before invoking it","Use a native package manager on non-Windows instead"],"exampleFix":"// before\nchoco list --source=windowsfeatures  # on Linux\n// after\n# run on Windows, or guard:\nif ($IsWindows) { choco list --source=windowsfeatures }","handlingStrategy":"type-guard","validationCode":"if (Platform.GetPlatform() != PlatformType.Windows) {\n    Console.Error.WriteLine(\"windowsfeatures source is Windows-only.\");\n    return;\n}","typeGuard":"static bool IsWindowsFeaturesSourceSupported() => Platform.GetPlatform() == PlatformType.Windows;","tryCatchPattern":null,"preventionTips":["Gate windowsfeatures commands behind a Windows platform check","Do not include the windowsfeatures source in cross-platform scripts","Use a native package manager on non-Windows systems"],"tags":["platform","windows-features","cross-platform"],"backgroundTag":null,"analyzedSha":"0d5abdd10cc177a141e69547cad6935b419b6c17","analyzedAt":"2026-08-13T18:33:03.301Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}