{"record":{"id":"02b62bab0829dfda","repo":"chocolatey/choco","slug":"stopping-further-execution-as-0-has-failed-insta","errorCode":null,"errorMessage":"Stopping further execution as {0} has failed install.","messagePattern":"Stopping further execution as (.+?) has failed install\\.","errorType":"exception","errorClass":"ApplicationException","httpStatus":null,"severity":"error","filePath":"src/chocolatey/infrastructure.app/services/NugetService.cs","lineNumber":891,"sourceCode":"                }\r\n\r\n                foreach (SourcePackageDependencyInfo packageDependencyInfo in resolvedPackages)\r\n                {\r\n                    // Don't attempt to action this package if dependencies failed.\r\n                    if (packageDependencyInfo != null && packageResultsToReturn.Any(r => r.Value.Success != true && packageDependencyInfo.Dependencies.Any(d => d.Id.Equals(r.Value.Identity.Id, StringComparison.OrdinalIgnoreCase))))\r\n                    {\r\n                        var logMessage = StringResources.ErrorMessages.DependencyFailedToInstall.FormatWith(packageDependencyInfo.Id);\r\n                        packageResultsToReturn\r\n                            .GetOrAdd(\r\n                                packageDependencyInfo.Id,\r\n                                new PackageResult(packageDependencyInfo.Id, packageDependencyInfo.Version.ToFullStringChecked(), string.Empty)\r\n                            )\r\n                            .Messages.Add(new ResultMessage(ResultType.Error, logMessage));\r\n                        this.Log().Error(ChocolateyLoggers.Important, logMessage);\r\n\r\n                        if (config.Features.StopOnFirstPackageFailure)\r\n                        {\r\n                            throw new ApplicationException(\"Stopping further execution as {0} has failed install.\".FormatWith(packageDependencyInfo.Id));\r\n                        }\r\n\r\n                        continue;\r\n                    }\r\n\r\n                    var packageRemoteMetadata = packagesToInstall.FirstOrDefault(p => p.Identity.Equals(packageDependencyInfo));\r\n\r\n                    if (packageRemoteMetadata is null)\r\n                    {\r\n                        var endpoint = NuGetEndpointResources.GetResourcesBySource(packageDependencyInfo.Source, sourceCacheContext);\r\n\r\n                        packageRemoteMetadata = endpoint.PackageMetadataResource\r\n                            .GetMetadataAsync(packageDependencyInfo, sourceCacheContext, _nugetLogger, CancellationToken.None)\r\n                            .GetAwaiter().GetResult();\r\n                    }\r\n\r\n                    var shouldAddForcedResultMessage = false;\r\n\r","sourceCodeStart":873,"sourceCodeEnd":909,"githubUrl":"https://github.com/chocolatey/choco/blob/0d5abdd10cc177a141e69547cad6935b419b6c17/src/chocolatey/infrastructure.app/services/NugetService.cs#L873-L909","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check the log for which dependency failed and why — the error message names the dependency ID.","Ensure all required sources are configured and accessible so dependencies can be resolved.","Disable the feature for resilient installs: 'choco feature disable --name=stopOnFirstPackageFailure'.","Install the failing dependency separately first to isolate the issue.","Verify the dependency version constraints in the package's .nuspec are satisfiable."],"exampleFix":"// before: dependency failure halts entire install batch\nchoco feature enable --name=stopOnFirstPackageFailure\nchoco install mypackage -y\n// Error: Stopping further execution as dep-pkg has failed install.\n\n// after: install dependency first, or disable feature\nchoco install dep-pkg -y\nchoco install mypackage -y\n// or:\nchoco feature disable --name=stopOnFirstPackageFailure\nchoco install mypackage -y","handlingStrategy":"validation","validationCode":"// Before installing, verify dependencies are available in configured sources\nif (config.Features.StopOnFirstPackageFailure)\n{\n    // Pre-check dependency availability to avoid mid-batch failure\n    var packageMetadata = _nugetService.FindPackageMetadata(config.PackageNames, config);\n    foreach (var dep in packageMetadata.Dependencies)\n    {\n        var depAvailable = _sourceResolver.IsPackageAvailable(dep.Id, dep.Version, config.Sources);\n        if (!depAvailable)\n        {\n            throw new InvalidOperationException($\"Dependency '{dep.Id}' is not available in configured sources.\");\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":"try\n{\n    _nugetService.Install(config, installAction, beforeModifyAction);\n}\ncatch (ApplicationException ex) when (ex.Message.Contains(\"failed install\"))\n{\n    // The dependency ID is in the message\n    logger.Error($\"Dependency install failed: {ex.Message}\");\n    // Options: install dependency separately, disable feature, or fix source config\n}","preventionTips":["Disable stopOnFirstPackageFailure for installs where partial success is acceptable.","Ensure all configured sources are accessible and contain required dependencies.","Install dependencies separately before the parent package to isolate failures.","Verify version constraints in .nuspec dependency declarations are satisfiable by available packages.","Use --debug to identify which specific dependency failed and why."],"tags":["dependency","install","stoponfirstpackagefailure","failure","nuget","chocolatey"],"backgroundTag":null,"analyzedSha":"0d5abdd10cc177a141e69547cad6935b419b6c17","analyzedAt":"2026-08-13T18:33:03.301Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}