{"record":{"id":"771cf9770e9b9bbc","repo":"chocolatey/choco","slug":"the-0-source-does-not-support-installing-packa","errorCode":null,"errorMessage":"The '{0}' source does not support installing packages","messagePattern":"The '(.+?)' source does not support installing packages","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs","lineNumber":804,"sourceCode":"                foreach (var packageConfig in GetConfigFromInputAndPackageConfigInput(config, packageInstalls, installSourceRunners).OrEmpty())\r\n                {\r\n                    ConcurrentDictionary<string, PackageResult> results;\r\n\r\n                    if (packageConfig.SourceType.IsEqualTo(SourceTypes.Normal))\r\n                    {\r\n                        var action = new Action<PackageResult, ChocolateyConfiguration>((packageResult, configuration) => HandlePackageResult(packageResult, configuration, CommandNameType.Install));\r\n                        var beforeModifyAction = new Action<PackageResult, ChocolateyConfiguration>((packageResult, configuration) => BeforeModifyAction(packageResult, configuration));\r\n\r\n                        results = _nugetService.Install(packageConfig, action, beforeModifyAction);\r\n                    }\r\n                    else\r\n                    {\r\n                        results = PerformSourceRunnerFunction<IInstallSourceRunner, ConcurrentDictionary<string, PackageResult>>(packageConfig, runner => runner.Install(packageConfig, null));\r\n                    }\r\n\r\n                    if (results is null)\r\n                    {\r\n                        throw new NotSupportedException(\"The '{0}' source does not support installing packages\".FormatWith(config.SourceType));\r\n                    }\r\n\r\n                    foreach (var result in results)\r\n                    {\r\n                        packageInstalls.GetOrAdd(result.Key, result.Value);\r\n                    }\r\n                }\r\n            }\r\n            finally\r\n            {\r\n                var actionSummaryResult = ReportActionSummary(packageInstalls, \"installed\");\r\n                if (actionSummaryResult.Failures != 0 && Environment.ExitCode == 0)\r\n                {\r\n                    Environment.ExitCode = 1;\r\n                }\r\n\r\n                RandomlyNotifyAboutLicensedFeatures(config);\r\n            }\r","sourceCodeStart":786,"sourceCodeEnd":822,"githubUrl":"https://github.com/chocolatey/choco/blob/0d5abdd10cc177a141e69547cad6935b419b6c17/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs#L786-L822","documentation":"Thrown as a NotSupportedException when an install operation against a non-normal source type returns null results. The code delegates to PerformSourceRunnerFunction<IInstallSourceRunner> for alternative sources; if no runner implementing IInstallSourceRunner is registered for the given SourceType, the function returns default (null), triggering this exception.","triggerScenarios":"Calling Install on ChocolateyPackageService with config.SourceType set to a non-normal value (e.g., 'python', 'ruby', 'cygwin', 'windowsfeatures') when no alternative source runner implementing IInstallSourceRunner is registered in the container for that source type.","commonSituations":"Using a source type that does not support installation (e.g., a read-only or list-only source), or a custom source runner that lacks the IInstallSourceRunner interface. Also triggered when a source type string is misspelled or refers to an unregistered runner.","solutions":["Verify the --source-type value matches a registered runner that implements IInstallSourceRunner.","If installing from a normal feed, do not set config.SourceType to an alternative type — leave it as 'normal'.","For custom runners, implement IInstallSourceRunner and register the runner class in the DI container.","Check that the source type string is spelled correctly and matches a constant in SourceTypes."],"exampleFix":"// before: custom runner missing install interface\npublic class MyRunner : IAlternativeSourceRunner { }\n\n// after: implement IInstallSourceRunner\npublic class MyRunner : IAlternativeSourceRunner, IInstallSourceRunner\n{\n    public ConcurrentDictionary<string, PackageResult> Install(\n        ChocolateyConfiguration config,\n        Action<PackageResult, ChocolateyConfiguration> continueAction,\n        Action<PackageResult, ChocolateyConfiguration> beforeModifyAction)\n    {\n        return new ConcurrentDictionary<string, PackageResult>();\n    }\n}","handlingStrategy":"validation","validationCode":"// Verify a runner implementing IInstallSourceRunner exists for the source type\nif (!config.SourceType.IsEqualTo(SourceTypes.Normal))\n{\n    var runners = _containerResolver.ResolveAll<IInstallSourceRunner>();\n    if (!runners.Any(r => r.SourceType.IsEqualTo(config.SourceType)))\n    {\n        throw new InvalidOperationException($\"No install runner registered for source type '{config.SourceType}'.\");\n    }\n}","typeGuard":"public static bool SourceTypeSupportsInstall(string sourceType, IEnumerable<IAlternativeSourceRunner> registeredRunners)\n{\n    if (sourceType.IsEqualTo(SourceTypes.Normal)) return true;\n    return registeredRunners.OfType<IInstallSourceRunner>().Any(r => r.SourceType.IsEqualTo(sourceType));\n}","tryCatchPattern":"try\n{\n    var results = _packageService.Install(config);\n}\ncatch (NotSupportedException ex) when (ex.Message.Contains(\"does not support installing\"))\n{\n    logger.Error($\"Source type '{config.SourceType}' does not support install. Use 'normal' source type.\");\n}","preventionTips":["Ensure config.SourceType matches a registered runner that implements IInstallSourceRunner.","For normal feed installs, leave SourceType unset or set to 'normal'.","Register custom runners in the DI container with all required interfaces.","Validate the source type string against SourceTypes constants."],"tags":["source-runner","alternative-source","install","notsupported","chocolatey"],"backgroundTag":null,"analyzedSha":"0d5abdd10cc177a141e69547cad6935b419b6c17","analyzedAt":"2026-08-13T18:33:03.301Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}