{"record":{"id":"450c984578487e43","repo":"chocolatey/choco","slug":"alternative-sources-do-not-allow-the-use-of-the-a-450c98","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/RubyGemsService.cs","lineNumber":216,"sourceCode":"        }\r\n\r\n        public void InstallDryRun(ChocolateyConfiguration config, Action<PackageResult, ChocolateyConfiguration> continueAction)\r\n        {\r\n            var args = ExternalCommandArgsBuilder.BuildArguments(config, _installArguments);\r\n            args = args.Replace(PackageNameToken, config.PackageNames.Replace(';', ','));\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            var packageResults = new ConcurrentDictionary<string, PackageResult>(StringComparer.InvariantCultureIgnoreCase);\r\n            var args = ExternalCommandArgsBuilder.BuildArguments(config, _installArguments);\r\n\r\n            foreach (var packageToInstall in config.PackageNames.Split(new[] { ApplicationParameters.PackageNamesSeparator }, StringSplitOptions.RemoveEmptyEntries))\r\n            {\r\n                var argsForPackage = args.Replace(PackageNameToken, packageToInstall);\r\n                var exitCode = _commandExecutor.Execute(\r\n                    ExePath,\r\n                    argsForPackage,\r\n                    config.CommandExecutionTimeoutSeconds,\r\n                    (s, e) =>\r\n                        {\r\n                            var logMessage = e.Data;\r\n                            if (string.IsNullOrWhiteSpace(logMessage))\r\n                            {\r\n                                return;\r","sourceCodeStart":198,"sourceCodeEnd":234,"githubUrl":"https://github.com/chocolatey/choco/blob/0d5abdd10cc177a141e69547cad6935b419b6c17/src/chocolatey/infrastructure.app/services/RubyGemsService.cs#L198-L234","documentation":"RubyGemsService.Install rejects the 'all' keyword: alternative sources cannot install all packages. If config.PackageNames equals ApplicationParameters.AllPackages it throws NotImplementedException before building arguments or running gem.","triggerScenarios":"Calling choco install with PackageNames == 'all' against the Ruby source (SourceTypes.Ruby).","commonSituations":"Reusing 'all' from a NuGet-style install against the gem source; scripted bulk install that does not apply to alternative sources.","solutions":["Install explicit gem names with the Ruby source","Never pass 'all' to alternative sources","Loop over a gem list in your script instead of using 'all'"],"exampleFix":"// before\nchoco install all --source=ruby\n// after\nchoco install rails sinatra --source=ruby","handlingStrategy":"validation","validationCode":"if (config.PackageNames == ApplicationParameters.AllPackages) {\n    throw new ArgumentException(\"The Ruby source does not support 'all'; pass explicit gem names.\");\n}","typeGuard":null,"tryCatchPattern":"try { rubyService.Install(config); }\ncatch (NotImplementedException ex) when (ex.Message.Contains(\"'all'\")) {\n    logger.Error(ex.Message); // pass explicit names\n}","preventionTips":["Never pass 'all' to the Ruby (or other alternative) source","List gems explicitly in scripts","Validate PackageNames against the source type before invoking"],"tags":["ruby","all-packages","install"],"backgroundTag":null,"analyzedSha":"0d5abdd10cc177a141e69547cad6935b419b6c17","analyzedAt":"2026-08-13T18:33:03.301Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}