chocolatey/choco · error · ApplicationException

The default push source configuration is not set. Either pas

Error message

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}'"`.

What it means

Thrown by ChocolateyPushCommand.Validate when no --source is provided and no defaultPushSource is configured in Chocolatey settings. Push requires a destination feed; if neither a CLI --source argument nor the 'defaultPushSource' config value is set, the command cannot determine where to push and aborts. The message includes the community feed URL as an example.

Source

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

            //todo: #2569 push command - allow disable buffering?
        }

        public virtual void ParseAdditionalArguments(IList<string> unparsedArguments, ChocolateyConfiguration configuration)
        {
            configuration.Input = string.Join(" ", unparsedArguments); // path to .nupkg - assume relative
        }

        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));

View on GitHub (pinned to 0d5abdd10c)

Solutions

  1. Pass the source explicitly: 'choco push --source="https://push.chocolatey.org/"'.
  2. Set a persistent default: 'choco config set --name="defaultPushSource" --value="https://push.chocolatey.org/"' then run 'choco push' without --source.
  3. For internal/private feeds, point to your internal NuGet repository URL.

Example fix

// before
choco push
// after
choco config set --name="defaultPushSource" --value="https://push.chocolatey.org/"
choco push
Defensive patterns

Strategy: validation

Validate before calling

// Ensure a push source is available before pushing
if (string.IsNullOrWhiteSpace(pushSource) && string.IsNullOrWhiteSpace(GetConfig("defaultPushSource")))
{
    Console.Error.WriteLine("No push source configured. Set defaultPushSource or pass --source.");
}

Prevention

When it happens

Trigger: Running 'choco push' without --source and without having set 'defaultPushSource' via 'choco config set'. The check is: configuration.Sources is null/empty AND configuration.PushCommand.DefaultSource is null/empty.

Common situations: First-time push on a fresh Chocolatey install where no default push source was ever configured. Or in CI/CD pipelines where the push source was expected to be pre-set but was not.

Related errors


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