chocolatey/choco · error · ApplicationException

Stopping further execution as {0} has failed {1}.

Error message

Stopping further execution as {0} has failed {1}.

What it means

Thrown as an ApplicationException during HandlePackageResult when a package install or upgrade fails (packageResult.Success is false) AND config.Features.StopOnFirstPackageFailure is enabled. The package has already been moved to the failure location and rolled back before the exception propagates, halting the entire batch.

Source

Thrown at src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs:595

            {
                if (config.Features.ExitOnRebootDetected)
                {
                    Environment.ExitCode = ApplicationParameters.ExitCodes.ErrorInstallSuspend;
                    this.Log().Warn(ChocolateyLoggers.Important, @"Chocolatey has detected a pending reboot after installing/upgrading
package '{0}' - stopping further execution".FormatWith(packageResult.Name));

                    throw new ApplicationException("Reboot required before continuing. Reboot and run the same command again.");
                }
            }

            if (!packageResult.Success)
            {
                this.Log().Error(ChocolateyLoggers.Important, "The {0} of {1} was NOT successful.".FormatWith(commandName.ToStringSafe(), packageResult.Name));
                HandleFailedOperation(config, packageResult, movePackageToFailureLocation: true, attemptRollback: true);

                if (config.Features.StopOnFirstPackageFailure)
                {
                    throw new ApplicationException("Stopping further execution as {0} has failed {1}.".FormatWith(packageResult.Name, commandName.ToStringSafe()));
                }

                return;
            }

            RemoveBackupIfExists(packageResult);

            this.Log().Info(ChocolateyLoggers.Important, " The {0} of {1} was successful.".FormatWith(commandName.ToStringSafe(), packageResult.Name));

            var installerDetected = Environment.GetEnvironmentVariable(EnvironmentVariables.Package.ChocolateyInstallerType);
            if (!string.IsNullOrWhiteSpace(pkgInfo.DeploymentLocation))
            {
                this.Log().Info(ChocolateyLoggers.Important, "  Deployed to '{0}'".FormatWith(pkgInfo.DeploymentLocation.EscapeCurlyBraces()));
            }
            else if (!string.IsNullOrWhiteSpace(installerDetected))
            {
                this.Log().Info(ChocolateyLoggers.Important, @"  Software installed as '{0}', install location is likely default.".FormatWith(installerDetected));
            }

View on GitHub (pinned to 0d5abdd10c)

Solutions

  1. Investigate the specific package failure in the log (the error for that package is logged before this exception).
  2. If you want remaining packages to install despite one failure, disable the feature: 'choco feature disable --name=stopOnFirstPackageFailure'.
  3. Fix or update the failing package, then re-run the command.
  4. Exclude the problematic package with --except or install packages individually to isolate the failure.

Example fix

// before: feature stops batch on first failure
choco feature enable --name=stopOnFirstPackageFailure
choco upgrade all -y  # stops on first failing package

// after: continue processing remaining packages
choco feature disable --name=stopOnFirstPackageFailure
choco upgrade all -y  # processes all, reports failures at end
Defensive patterns

Strategy: validation

Validate before calling

// Validate the feature flag and known-good packages before batch operations
if (config.Features.StopOnFirstPackageFailure)
{
    logger.Info("stopOnFirstPackageFailure is enabled — batch will abort on first failure.");
    // Consider pre-checking each package's availability
    foreach (var name in config.PackageNames.Split(';'))
    {
        if (string.IsNullOrWhiteSpace(name)) continue;
        // Verify package exists in source before committing
    }
}

Try / catch

try
{
    _packageService.Install(config);
}
catch (ApplicationException ex) when (ex.Message.Contains("Stopping further execution"))
{
    // The failing package name is in the message
    // Other packages were NOT processed — re-run without the failing one
    logger.Error($"Batch stopped: {ex.Message}");
    logger.Info("Disable stopOnFirstPackageFailure or fix the failing package and retry.");
}

Prevention

When it happens

Trigger: Inside HandlePackageResult, after HandleFailedOperation runs (moves package to failure location and attempts rollback), if config.Features.StopOnFirstPackageFailure is true and packageResult.Success is false, this exception is thrown immediately, preventing subsequent packages in the batch from being processed.

Common situations: Running 'choco upgrade all -y' or a multi-package install where one package fails. With stopOnFirstPackageFailure enabled, the first failure aborts the entire run. Without it, Chocolatey continues processing remaining packages and reports failures at the end.

Related errors


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