chocolatey/choco · error · ApplicationException

Multiple sources are not supported by push command.

Error message

Multiple sources are not supported by push command.

What it means

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.

Source

Thrown at src/chocolatey/infrastructure.app/commands/ChocolateyPushCommand.cs:82

        public virtual void Validate(ChocolateyConfiguration configuration)
        {
            if (string.IsNullOrWhiteSpace(configuration.Sources))
            {
                if (!string.IsNullOrWhiteSpace(configuration.PushCommand.DefaultSource))
                {
                    configuration.Sources = configuration.PushCommand.DefaultSource;
                }
                else
                {
                    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));
                }
            }

            IEnumerable<string> sources = configuration.Sources.Split(new[] { ";", "," }, StringSplitOptions.RemoveEmptyEntries);

            if (sources.Count() > 1)
            {
                throw new ApplicationException("Multiple sources are not supported by push command.");
            }

            var remoteSource = new Uri(configuration.Sources);
            if (string.IsNullOrWhiteSpace(configuration.PushCommand.Key) && !remoteSource.IsUnc && !remoteSource.IsFile)
            {
                // perform a lookup
                configuration.PushCommand.Key = _configSettingsService.GetApiKey(configuration, null);
                if (string.IsNullOrWhiteSpace(configuration.PushCommand.Key))
                {
                    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));
                }
            }

            // security advisory
            if (!configuration.Force || configuration.Sources.ToLowerSafe().Contains("chocolatey.org"))
            {
                if (remoteSource.Scheme == "http" && remoteSource.Host != "localhost")
                {

View on GitHub (pinned to 0d5abdd10c)

Solutions

  1. Provide exactly one source URL for push: 'choco push --source="https://push.chocolatey.org/"'.
  2. If you need to push to multiple feeds, run 'choco push' separately for each feed.
  3. Check that your defaultPushSource config value does not contain delimiters.

Example fix

// before
choco push --source="https://feed1;https://feed2"
// after
choco push --source="https://feed1"
choco push --source="https://feed2"
Defensive patterns

Strategy: validation

Validate before calling

// Ensure exactly one source for push
var sources = pushSource.Split(new[] { ';', ',' }, StringSplitOptions.RemoveEmptyEntries);
if (sources.Length > 1)
{
    Console.Error.WriteLine("Push supports only a single source. Use separate calls per feed.");
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of chocolatey/choco@0d5abdd10c (2026-08-13). Data as JSON: /api/errors/79a1346ea37af9e5. Report an issue: GitHub.