chocolatey/choco · error · ApplicationException
{0} {1} not successful.
Error message
{0} {1} not successful. What it means
Thrown as an ApplicationException during HandlePackageUninstallResult when packageResult.Success is false after an uninstall attempt. This explicitly stops the NuGet service from continuing with package removal — it is a hard failure that propagates up. The message formats the package name and 'uninstall' as the operation.
Source
Thrown at src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs:1560
HandleFailedOperation(config, packageResult, movePackageToFailureLocation: true, attemptRollback: true);
}
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 uninstalling
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)
{
// throw an error so that NuGet Service doesn't attempt to continue with package removal
throw new ApplicationException("{0} {1} not successful.".FormatWith(packageResult.Name, "uninstall"));
}
}
private void UninstallCleanup(ChocolateyConfiguration config, PackageResult packageResult)
{
if (config.Features.RemovePackageInformationOnUninstall)
{
_packageInfoService.Remove(packageResult.PackageMetadata);
}
EnsureBadPackagesPathIsClean(packageResult);
RemoveBackupIfExists(packageResult);
HandleExtensionPackages(config, packageResult);
HandleTemplatePackages(config, packageResult);
HandleHookPackages(config, packageResult);
if (config.Force)
{
View on GitHub (pinned to 0d5abdd10c)
Solutions
- Check the log output for the specific uninstaller error — the Error-level log before this exception explains what went wrong.
- Use --force to bypass exit code checks: 'choco uninstall pkg -y --force'.
- Close applications that may be locking the package files before uninstalling.
- Manually remove leftover files from the package directory in the lib folder if the uninstaller partially completed.
Example fix
// before: uninstall fails due to locked files or exit code choco uninstall mypackage -y // after: force removal, or close locking processes first choco uninstall mypackage -y --force // or manually clean up Remove-Item -Recurse -Force $env:ChocolateyInstall\lib\mypackage
Defensive patterns
Strategy: try-catch
Validate before calling
// Before uninstall, verify the package is installed and not locked
foreach (var name in config.PackageNames.Split(';'))
{
var pkgDir = _fileSystem.CombinePaths(ApplicationParameters.PackagesLocation, name);
if (!_fileSystem.DirectoryExists(pkgDir))
{
throw new InvalidOperationException($"Package '{name}' is not installed locally.");
}
} Try / catch
try
{
_packageService.Uninstall(config);
}
catch (ApplicationException ex) when (ex.Message.Contains("not successful"))
{
// The specific package and 'uninstall' are in the message
logger.Error($"Uninstall failed: {ex.Message}");
// Optionally retry with --force or clean up manually
logger.Info("Try: choco uninstall <pkg> -y --force");
} Prevention
- Close all applications that may be locking package files before uninstalling.
- Use --force to bypass exit code validation when the uninstaller leaves non-critical artifacts.
- Check the log output for the specific uninstaller error before this exception.
- Manually remove the package directory from the lib folder if the uninstaller partially completed.
When it happens
Trigger: Inside HandlePackageUninstallResult, after checking reboot exit codes, the code checks packageResult.Success. If false (the uninstaller reported failure, non-zero exit code, or an error occurred), this exception is thrown unconditionally — there is no feature flag to skip it, unlike the StopOnFirstPackageFailure flow.
Common situations: An uninstaller returns a non-zero exit code (not a reboot code), a chocolateyUninstall.ps1 script errors out, or files are locked preventing removal. The error message follows the pattern '{packageName} uninstall not successful.'
Related errors
- Reboot required before continuing. Reboot and run the same c
- Stopping further execution as {0} has failed {1}.
- The '{0}' source does not support uninstalling packages
- Stopping further execution as {0} has failed install.
- Automatic package creation from installer files only availab
AI-assisted analysis of chocolatey/choco@0d5abdd10c (2026-08-13).
Data as JSON: /api/errors/a5060811cd03cf66.
Report an issue: GitHub.