{"record":{"id":"32f2fb74aeda27bd","repo":"chocolatey/choco","slug":"alternative-sources-do-not-allow-the-use-of-the-a","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/CygwinService.cs","lineNumber":224,"sourceCode":"            return args;\r\n        }\r\n\r\n        public void InstallDryRun(ChocolateyConfiguration config, Action<PackageResult, ChocolateyConfiguration> continueAction)\r\n        {\r\n            var args = BuildArgs(config, _installArguments);\r\n            this.Log().Info(\"Would have run '{0} {1}'\".FormatWith(GetCygwinPath(RootDirectory).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 args = BuildArgs(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 argsForPackage = args.Replace(PackageNameToken, packageToInstall);\r\n\r\n                var exitCode = _commandExecutor.Execute(\r\n                    GetCygwinPath(RootDirectory),\r\n                    argsForPackage,\r\n                    config.CommandExecutionTimeoutSeconds,\r\n                    _fileSystem.GetCurrentDirectory(),\r\n                    (s, e) =>\r\n                        {\r\n                            var logMessage = e.Data;\r\n                            if (string.IsNullOrWhiteSpace(logMessage))\r","sourceCodeStart":206,"sourceCodeEnd":242,"githubUrl":"https://github.com/chocolatey/choco/blob/0d5abdd10cc177a141e69547cad6935b419b6c17/src/chocolatey/infrastructure.app/services/CygwinService.cs#L206-L242","documentation":"Thrown as a NotImplementedException in CygwinService.Install when config.PackageNames equals ApplicationParameters.AllPackages (the 'all' keyword). Alternative source types like Cygwin do not support the 'all' keyword because their install mechanisms process packages one at a time through external tooling (Cygwin setup.exe) that does not have a reliable 'install everything' equivalent.","triggerScenarios":"Calling CygwinService.Install (via 'choco install all --source-type=cygwin') where config.PackageNames is exactly equal to ApplicationParameters.AllPackages. The equality check uses IsEqualTo (case-insensitive) before any package processing begins.","commonSituations":"A user or script runs 'choco install all --source-type=cygwin' expecting to install all available Cygwin packages. This is explicitly blocked for alternative sources. The 'all' keyword is only valid for normal Chocolatey/NuGet sources.","solutions":["List individual Cygwin package names explicitly: 'choco install bash wget curl --source-type=cygwin'.","Do not use the 'all' keyword with alternative source types — it is only supported for normal sources.","If you need multiple Cygwin packages, enumerate them or use a packages.config file with the normal install command."],"exampleFix":"// before: using 'all' keyword with Cygwin source\nchoco install all --source-type=cygwin\n\n// after: specify individual package names\nchoco install bash wget curl --source-type=cygwin","handlingStrategy":"validation","validationCode":"// Before calling Install on an alternative source, reject the 'all' keyword\nif (!config.SourceType.IsEqualTo(SourceTypes.Normal) &&\n    config.PackageNames.IsEqualTo(ApplicationParameters.AllPackages))\n{\n    throw new InvalidOperationException(\n        \"The 'all' keyword is not supported by alternative source types. List individual package names.\");\n}","typeGuard":"public static bool IsValidPackageNamesForAlternativeSource(string packageNames, string sourceType)\n{\n    if (sourceType.IsEqualTo(SourceTypes.Normal)) return true;\n    return !packageNames.IsEqualTo(ApplicationParameters.AllPackages);\n}","tryCatchPattern":"try\n{\n    _cygwinService.Install(config, action);\n}\ncatch (NotImplementedException ex) when (ex.Message.Contains(\"'all' package name\"))\n{\n    logger.Error(\"Cannot use 'all' with Cygwin source. Specify individual Cygwin package names.\");\n}","preventionTips":["Never use the 'all' keyword with alternative source types (cygwin, python, ruby, windowsfeatures).","Enumerate specific package names for alternative source installs.","Validate package names before calling alternative source APIs."],"tags":["cygwin","alternative-source","all-keyword","validation","install","chocolatey"],"backgroundTag":null,"analyzedSha":"0d5abdd10cc177a141e69547cad6935b419b6c17","analyzedAt":"2026-08-13T18:33:03.301Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}