chocolatey/choco · error · ApplicationException

Installing all packages from {0} is not supported.{1}Only in

Error message

Installing all packages from {0} is not supported.{1}Only internal NuGet repositories are supported.

What it means

SetRemotePackageNamesIfAllSpecified refuses the 'all' keyword when the configured sources include any public NuGet feed (ApplicationParameters.PublicNuGetSources). Bulk-installing everything from public repos is unsupported; only internal repositories are allowed, so it throws ApplicationException.

Source

Thrown at src/chocolatey/infrastructure.app/services/NugetService.cs:3233

                if (customAction != null)
                {
                    customAction.Invoke();
                }
            }

            return allPackages;
        }

        private void SetRemotePackageNamesIfAllSpecified(ChocolateyConfiguration config, Action customAction)
        {
            if (config.PackageNames.IsEqualTo(ApplicationParameters.AllPackages))
            {
                foreach (var repositoryUrl in ApplicationParameters.PublicNuGetSources)
                {
                    if (config.Sources.Contains(repositoryUrl.TrimEnd(('/'))))
                    {
                        throw new ApplicationException("Installing all packages from {0} is not supported.{1}Only internal NuGet repositories are supported."
                            .FormatWith(repositoryUrl, Environment.NewLine));
                    }
                }

                var isQuiet = config.QuietOutput;
                config.QuietOutput = true;
                var input = config.Input;
                config.Input = string.Empty;
                var remotePackageList = List(config).Select(p => p.Name).Distinct().ToList();
                config.QuietOutput = isQuiet;
                config.Input = input;

                config.PackageNames = remotePackageList.Join(ApplicationParameters.PackageNamesSeparator);

                if (customAction != null)
                {
                    customAction.Invoke();
                }

View on GitHub (pinned to 0d5abdd10c)

Solutions

  1. Specify explicit package names instead of 'all'
  2. Scope the command to an internal source only (choco install all --source=<internal-repo>)
  3. Disable public sources for the run before using 'all'
  4. Set up and use an internal NuGet repository as the sole source

Example fix

// before
choco install all
// after
choco install all --source=https://internal-feed/nuget
Defensive patterns

Strategy: validation

Validate before calling

// Reject 'all' before invoking when any public source is enabled.
var publicSources = ApplicationParameters.PublicNuGetSources.Select(s => s.TrimEnd('/'));
if (config.PackageNames == ApplicationParameters.AllPackages && config.Sources.Split(',').Any(s => publicSources.Contains(s.TrimEnd('/')))) {
    throw new InvalidOperationException("'all' is not allowed with public NuGet sources; specify names or use an internal source.");
}

Try / catch

try { choco.Install(config); }
catch (ApplicationException ex) when (ex.Message.Contains("Installing all packages")) {
    logger.Error(ex.Message); // switch to explicit names or an internal source
}

Prevention

When it happens

Trigger: Running choco install/upgrade/list with PackageNames equal to ApplicationParameters.AllPackages ('all') while config.Sources contains a public NuGet URL (trimmed of trailing '/') from PublicNuGetSources.

Common situations: User passes 'all' while the community/chocolatey public source is still enabled; a script reuses 'all' across a mixed source list including a public feed; CI config mistakenly sets PackageNames=all with default sources.

Related errors


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