chocolatey/choco · critical · ApplicationException

Reboot required before continuing. Reboot and run the same c

Error message

Reboot required before continuing. Reboot and run the same command again.

What it means

Thrown as an ApplicationException during HandlePackageResult (install/upgrade flow) when the package installer returns an exit code in _rebootExitCodes (1641 or 3010) AND config.Features.ExitOnRebootDetected is enabled. The environment exit code is first set to ApplicationParameters.ExitCodes.ErrorInstallSuspend (ERROR_INSTALL_SUSPEND), a warning is logged, then this exception halts all further package processing.

Source

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

            pkgInfo.DeploymentLocation = Environment.GetEnvironmentVariable(EnvironmentVariables.Package.ChocolateyPackageInstallLocation);
            pkgInfo.SourceInstalledFrom = packageResult.SourceInstalledFrom;

            UpdatePackageInformation(pkgInfo);
            EnsureBadPackagesPathIsClean(packageResult);
            EventManager.Publish(new HandlePackageResultCompletedMessage(packageResult, config, commandName));

            UnmarkPackagePending(packageResult, config);

            if (_rebootExitCodes.Contains(packageResult.ExitCode))
            {
                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);

View on GitHub (pinned to 0d5abdd10c)

Solutions

  1. Reboot the machine, then re-run the same choco command — Chocolatey resumes from where it stopped.
  2. If unattended and reboots are handled externally, disable the feature: 'choco feature disable --name=exitOnRebootDetected' so Chocolatey continues past reboot exit codes.
  3. Ensure packages that report reboot exit codes are ordered last in batch installs, or split them into a separate install run.
  4. Capture and handle the ErrorInstallSuspend exit code in your automation script to trigger a reboot cycle.

Example fix

// before: feature enabled, halts on reboot exit codes
choco feature enable --name=exitOnRebootDetected
choco upgrade all -y

// after: disable feature for unattended scenarios, or reboot and re-run
dism /online /Reboot /Quiet  # or shutdown /r /t 0
choco upgrade all -y
Defensive patterns

Strategy: validation

Validate before calling

// Check reboot exit codes and feature flag before expecting install to complete
var rebootExitCodes = new[] { 1641, 3010 };
if (config.Features.ExitOnRebootDetected)
{
    // Warn automation that a reboot may halt execution
    logger.Info("exitOnRebootDetected is enabled — installs may halt if a reboot is required.");
}
// After install, check if exit code indicates reboot needed
if (rebootExitCodes.Contains(Environment.ExitCode))
{
    // Schedule reboot and re-run
    logger.Warn("Reboot required. Schedule restart and re-run the command.");
}

Try / catch

try
{
    _packageService.Install(config);
}
catch (ApplicationException ex) when (ex.Message.Contains("Reboot required"))
{
    // ExitCode is already set to ErrorInstallSuspend
    // Trigger reboot in automation, then re-run the same command
    ScheduleRebootAndRerun();
}

Prevention

When it happens

Trigger: An installer embedded in a Chocolatey package exits with code 1641 (ERROR_SUCCESS_REBOOT_INITIATED) or 3010 (ERROR_SUCCESS_REBOOT_REQUIRED) while config.Features.ExitOnRebootDetected is true. This occurs inside HandlePackageResult after the package has been processed and UnmarkPackagePending has been called.

Common situations: Installing or upgrading a package (e.g., a driver, .NET runtime, or system update MSI) that requires a reboot. The 'exitOnRebootDetected' feature flag is enabled, causing Chocolatey to stop mid-batch instead of continuing to the next package.

Related errors


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