{"record":{"id":"79a1346ea37af9e5","repo":"chocolatey/choco","slug":"multiple-sources-are-not-supported-by-push-command","errorCode":null,"errorMessage":"Multiple sources are not supported by push command.","messagePattern":"Multiple sources are not supported by push command\\.","errorType":"validation","errorClass":"ApplicationException","httpStatus":null,"severity":"error","filePath":"src/chocolatey/infrastructure.app/commands/ChocolateyPushCommand.cs","lineNumber":82,"sourceCode":"        public virtual void Validate(ChocolateyConfiguration configuration)\r\n        {\r\n            if (string.IsNullOrWhiteSpace(configuration.Sources))\r\n            {\r\n                if (!string.IsNullOrWhiteSpace(configuration.PushCommand.DefaultSource))\r\n                {\r\n                    configuration.Sources = configuration.PushCommand.DefaultSource;\r\n                }\r\n                else\r\n                {\r\n                    throw new ApplicationException(\"The default push source configuration is not set. Either pass a source to push to, such as `--source=\\\"'{0}'\\\"`, or set the `defaultPushSource` configuration value, for example `choco config set --name=\\\"'defaultPushSource'\\\" --value=\\\"'{0}'\\\"`.\".FormatWith(ApplicationParameters.ChocolateyCommunityFeedPushSource));\r\n                }\r\n            }\r\n\r\n            IEnumerable<string> sources = configuration.Sources.Split(new[] { \";\", \",\" }, StringSplitOptions.RemoveEmptyEntries);\r\n\r\n            if (sources.Count() > 1)\r\n            {\r\n                throw new ApplicationException(\"Multiple sources are not supported by push command.\");\r\n            }\r\n\r\n            var remoteSource = new Uri(configuration.Sources);\r\n            if (string.IsNullOrWhiteSpace(configuration.PushCommand.Key) && !remoteSource.IsUnc && !remoteSource.IsFile)\r\n            {\r\n                // perform a lookup\r\n                configuration.PushCommand.Key = _configSettingsService.GetApiKey(configuration, null);\r\n                if (string.IsNullOrWhiteSpace(configuration.PushCommand.Key))\r\n                {\r\n                    throw new ApplicationException(\"An API key was not found for '{0}'. You must either set an API key with the apikey command or specify one with --api-key.\".FormatWith(configuration.Sources));\r\n                }\r\n            }\r\n\r\n            // security advisory\r\n            if (!configuration.Force || configuration.Sources.ToLowerSafe().Contains(\"chocolatey.org\"))\r\n            {\r\n                if (remoteSource.Scheme == \"http\" && remoteSource.Host != \"localhost\")\r\n                {\r","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/chocolatey/choco/blob/0d5abdd10cc177a141e69547cad6935b419b6c17/src/chocolatey/infrastructure.app/commands/ChocolateyPushCommand.cs#L64-L100","documentation":"Thrown by ChocolateyPushCommand.Validate when the resolved --source string (after splitting on ';' and ',') yields more than one source. NuGet push is a single-target operation — it uploads one .nupkg to one feed — so multiple sources are not supported by the underlying push API.","triggerScenarios":"Passing a --source value containing semicolons or commas that produce multiple segments, e.g. 'choco push --source=\"source1;source2\"' or '--source=\"feedA,feedB\". Any value that splits into 2+ non-empty entries triggers this.","commonSituations":"User copies a multi-source string (common for 'choco install' which does support multiple sources) and tries to reuse it for push. Or a configuration variable inadvertently contains a delimited list.","solutions":["Provide exactly one source URL for push: 'choco push --source=\"https://push.chocolatey.org/\"'.","If you need to push to multiple feeds, run 'choco push' separately for each feed.","Check that your defaultPushSource config value does not contain delimiters."],"exampleFix":"// before\nchoco push --source=\"https://feed1;https://feed2\"\n// after\nchoco push --source=\"https://feed1\"\nchoco push --source=\"https://feed2\"","handlingStrategy":"validation","validationCode":"// Ensure exactly one source for push\nvar sources = pushSource.Split(new[] { ';', ',' }, StringSplitOptions.RemoveEmptyEntries);\nif (sources.Length > 1)\n{\n    Console.Error.WriteLine(\"Push supports only a single source. Use separate calls per feed.\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never pass delimited multi-source strings to 'choco push'.","Run 'choco push' once per target feed."],"tags":["chocolatey","push-command","multiple-sources","argument-validation"],"backgroundTag":null,"analyzedSha":"0d5abdd10cc177a141e69547cad6935b419b6c17","analyzedAt":"2026-08-13T18:33:03.301Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}