{"record":{"id":"13b465ba3427ed50","repo":"chocolatey/choco","slug":"alternative-sources-do-not-allow-the-use-of-the-a-13b465","errorCode":null,"errorMessage":"Alternative sources do not allow the use of the 'all' package name/keyword.","messagePattern":"Alternative sources do not allow the use of the 'all' package name/keyword\\.","errorType":"exception","errorClass":"NotImplementedException","httpStatus":null,"severity":"error","filePath":"src/chocolatey/infrastructure.app/services/WindowsFeatureService.cs","lineNumber":292,"sourceCode":"        }\r\n\r\n        public void InstallDryRun(ChocolateyConfiguration config, Action<PackageResult, ChocolateyConfiguration> continueAction)\r\n        {\r\n            EnsureExecutablePathSet();\r\n            var args = BuildArguments(config, _installArguments);\r\n            this.Log().Info(\"Would have run '{0} {1}'\".FormatWith(_exePath.EscapeCurlyBraces(), args.EscapeCurlyBraces()));\r\n        }\r\n\r\n        public ConcurrentDictionary<string, PackageResult> Install(ChocolateyConfiguration config, Action<PackageResult, ChocolateyConfiguration> continueAction)\r\n        {\r\n            return Install(config, continueAction, beforeModifyAction: null);\r\n        }\r\n\r\n        public ConcurrentDictionary<string, PackageResult> Install(ChocolateyConfiguration config, Action<PackageResult, ChocolateyConfiguration> continueAction, Action<PackageResult, ChocolateyConfiguration> beforeModifyAction)\r\n        {\r\n            if (config.PackageNames.IsEqualTo(ApplicationParameters.AllPackages))\r\n            {\r\n                throw new NotImplementedException(\"Alternative sources do not allow the use of the 'all' package name/keyword.\");\r\n            }\r\n\r\n            EnsureExecutablePathSet();\r\n            var args = BuildArguments(config, _installArguments);\r\n            var packageResults = new ConcurrentDictionary<string, PackageResult>(StringComparer.InvariantCultureIgnoreCase);\r\n\r\n            foreach (var packageToInstall in config.PackageNames.Split(new[] { ApplicationParameters.PackageNamesSeparator }, StringSplitOptions.RemoveEmptyEntries))\r\n            {\r\n                var packageName = packageToInstall;\r\n                var results = packageResults.GetOrAdd(packageToInstall, new PackageResult(packageName, null, null));\r\n                var argsForPackage = args.Replace(PackageNameToken, packageName);\r\n\r\n                //todo: #2574 detect windows feature is already enabled\r\n                /*\r\n                      $checkStatement=@\"\r\n                    `$dismInfo=(cmd /c `\"$dism /Online /Get-FeatureInfo /FeatureName:$packageName`\")\r\n                    if(`$dismInfo -contains 'State : Enabled') {return}\r\n                    if(`$dismInfo -contains 'State : Enable Pending') {return}\r","sourceCodeStart":274,"sourceCodeEnd":310,"githubUrl":"https://github.com/chocolatey/choco/blob/0d5abdd10cc177a141e69547cad6935b419b6c17/src/chocolatey/infrastructure.app/services/WindowsFeatureService.cs#L274-L310","documentation":"Thrown by WindowsFeatureService.Install when the resolved package names equal the 'all' keyword (ApplicationParameters.AllPackages). Alternative sources (Windows Features, Python, Ruby, Cygwin, etc.) cannot install every available item at once the way the normal Chocolatey feed can, so 'all' is explicitly rejected as not implemented for these source types.","triggerScenarios":"Running `choco install all --source windowsfeatures` (or any other alternative source routed through WindowsFeatureService) where config.PackageNames resolves to the AllPackages token. The guard config.PackageNames.IsEqualTo(ApplicationParameters.AllPackages) matches case-insensitively before any argument building.","commonSituations":"Scripts or automation that blindly pass 'all' as the package name get reused when switching a source from the default Chocolatey feed to windowsfeatures. Users assuming 'choco install all' semantics carry over to every source type.","solutions":["Replace 'all' with an explicit, comma-separated list of the Windows feature names you want (e.g. choco install TelnetClient,IIS-WebServer --source windowsfeatures).","Query available features first with `choco search --source windowsfeatures` or `Get-WindowsFeature` to enumerate exact names.","If you genuinely need bulk install of all features, script the enumeration and install each feature by name in a loop."],"exampleFix":"// before\nchoco install all --source windowsfeatures\n\n// after\nchoco install TelnetClient,IIS-WebServer --source windowsfeatures","handlingStrategy":"validation","validationCode":"var names = config.PackageNames\n    .Split(ApplicationParameters.PackageNamesSeparator)\n    .Select(n => n.Trim())\n    .Where(n => !string.IsNullOrWhiteSpace(n));\nif (names.Any(n => n.IsEqualTo(ApplicationParameters.AllPackages)))\n{\n    throw new InvalidOperationException(\n        \"The 'all' keyword is not supported for alternative sources. \" +\n        \"Enumerate features explicitly via choco search --source windowsfeatures.\");\n}","typeGuard":null,"tryCatchPattern":"try\n{\n    service.Install(config, continueAction);\n}\ncatch (NotImplementedException ex) when (ex.Message.Contains(\"'all'\"))\n{\n    logger.Error(\"Cannot use 'all' with this source. Specify explicit feature names.\");\n}","preventionTips":["Never pass 'all' to an alternative source; build an explicit list from choco search --source <name>.","Validate package names against ApplicationParameters.AllPackages before dispatching to an alternative-source service."],"tags":["windows-features","alternative-source","validation","notimplemented"],"backgroundTag":null,"analyzedSha":"0d5abdd10cc177a141e69547cad6935b419b6c17","analyzedAt":"2026-08-13T18:33:03.301Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}