chocolatey/choco · error · ApplicationException

Stopping further execution as {0} has failed install.

Error message

Stopping further execution as {0} has failed install.

What it means

Thrown as an ApplicationException during dependency installation in NugetService when a package dependency fails to install AND config.Features.StopOnFirstPackageFailure is enabled. The dependency's failure is logged as an error and added to the results with a ResultMessage, then if the feature is active, this exception immediately halts the install batch.

Source

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

                }

                foreach (SourcePackageDependencyInfo packageDependencyInfo in resolvedPackages)
                {
                    // Don't attempt to action this package if dependencies failed.
                    if (packageDependencyInfo != null && packageResultsToReturn.Any(r => r.Value.Success != true && packageDependencyInfo.Dependencies.Any(d => d.Id.Equals(r.Value.Identity.Id, StringComparison.OrdinalIgnoreCase))))
                    {
                        var logMessage = StringResources.ErrorMessages.DependencyFailedToInstall.FormatWith(packageDependencyInfo.Id);
                        packageResultsToReturn
                            .GetOrAdd(
                                packageDependencyInfo.Id,
                                new PackageResult(packageDependencyInfo.Id, packageDependencyInfo.Version.ToFullStringChecked(), string.Empty)
                            )
                            .Messages.Add(new ResultMessage(ResultType.Error, logMessage));
                        this.Log().Error(ChocolateyLoggers.Important, logMessage);

                        if (config.Features.StopOnFirstPackageFailure)
                        {
                            throw new ApplicationException("Stopping further execution as {0} has failed install.".FormatWith(packageDependencyInfo.Id));
                        }

                        continue;
                    }

                    var packageRemoteMetadata = packagesToInstall.FirstOrDefault(p => p.Identity.Equals(packageDependencyInfo));

                    if (packageRemoteMetadata is null)
                    {
                        var endpoint = NuGetEndpointResources.GetResourcesBySource(packageDependencyInfo.Source, sourceCacheContext);

                        packageRemoteMetadata = endpoint.PackageMetadataResource
                            .GetMetadataAsync(packageDependencyInfo, sourceCacheContext, _nugetLogger, CancellationToken.None)
                            .GetAwaiter().GetResult();
                    }

                    var shouldAddForcedResultMessage = false;

View on GitHub (pinned to 0d5abdd10c)

Solutions

  1. Check the log for which dependency failed and why — the error message names the dependency ID.
  2. Ensure all required sources are configured and accessible so dependencies can be resolved.
  3. Disable the feature for resilient installs: 'choco feature disable --name=stopOnFirstPackageFailure'.
  4. Install the failing dependency separately first to isolate the issue.
  5. Verify the dependency version constraints in the package's .nuspec are satisfiable.

Example fix

// before: dependency failure halts entire install batch
choco feature enable --name=stopOnFirstPackageFailure
choco install mypackage -y
// Error: Stopping further execution as dep-pkg has failed install.

// after: install dependency first, or disable feature
choco install dep-pkg -y
choco install mypackage -y
// or:
choco feature disable --name=stopOnFirstPackageFailure
choco install mypackage -y
Defensive patterns

Strategy: validation

Validate before calling

// Before installing, verify dependencies are available in configured sources
if (config.Features.StopOnFirstPackageFailure)
{
    // Pre-check dependency availability to avoid mid-batch failure
    var packageMetadata = _nugetService.FindPackageMetadata(config.PackageNames, config);
    foreach (var dep in packageMetadata.Dependencies)
    {
        var depAvailable = _sourceResolver.IsPackageAvailable(dep.Id, dep.Version, config.Sources);
        if (!depAvailable)
        {
            throw new InvalidOperationException($"Dependency '{dep.Id}' is not available in configured sources.");
        }
    }
}

Try / catch

try
{
    _nugetService.Install(config, installAction, beforeModifyAction);
}
catch (ApplicationException ex) when (ex.Message.Contains("failed install"))
{
    // The dependency ID is in the message
    logger.Error($"Dependency install failed: {ex.Message}");
    // Options: install dependency separately, disable feature, or fix source config
}

Prevention

When it happens

Trigger: During the install flow's dependency resolution loop, a dependency package (identified by packageDependencyInfo) fails to install. The code adds an error ResultMessage ('Dependency {id} failed to install'), logs it, and if config.Features.StopOnFirstPackageFailure is true, throws this exception to stop further processing.

Common situations: Installing a package that has dependencies, where one dependency cannot be found in any configured source, or a dependency's own install fails. With stopOnFirstPackageFailure enabled, the first dependency failure aborts the entire operation including the parent package install.

Related errors


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