{"record":{"id":"37f64b1dcf2f4417","repo":"chocolatey/choco","slug":"stopping-further-execution-as-0-has-failed","errorCode":null,"errorMessage":"Stopping further execution as {0} has failed.","messagePattern":"Stopping further execution as (.+?) has failed\\.","errorType":"exception","errorClass":"ApplicationException","httpStatus":null,"severity":"error","filePath":"src/chocolatey/infrastructure.app/services/NugetService.cs","lineNumber":1712,"sourceCode":"                                existingPackage.Messages.Add(message);\r\n\r\n                                break;\r\n                            }\r\n\r\n                            // Don't attempt to action this package if dependencies failed.\r\n                            if (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, packageDependencyInfo.Version);\r\n                                packageResultsToReturn.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.\".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 packageToUninstall = packagesToUninstall.FirstOrDefault(p => p.PackageMetadata.Id.Equals(packageDependencyInfo.Id, StringComparison.OrdinalIgnoreCase));\r\n\r","sourceCodeStart":1694,"sourceCodeEnd":1730,"githubUrl":"https://github.com/chocolatey/choco/blob/0d5abdd10cc177a141e69547cad6935b419b6c17/src/chocolatey/infrastructure.app/services/NugetService.cs#L1694-L1730","documentation":"Thrown during a package install/upgrade when a dependency of the current package already failed earlier in the same run (a result with Success != true whose Id matches one of the package's declared dependencies). Chocolatey logs a DependencyFailedToInstall error and, with StopOnFirstPackageFailure enabled, aborts the run via this ApplicationException.","triggerScenarios":"Processing packageDependencyInfo whose Dependencies collection contains an Id that already has a failed (Success != true) entry in packageResultsToReturn, while config.Features.StopOnFirstPackageFailure is true.","commonSituations":"A dependency failed to download (network) or its own install script errored, so the dependent package cannot proceed; misordered install plan with StopOnFirstPackageFailure; a dependency pinned to a version that fails its install.","solutions":["Resolve the failing dependency first: re-run install for just that package and inspect its specific error","Ensure network/source access for the dependency package and its correct version","Disable stopOnFirstPackageFailure to continue past the dependency failure","Pin compatible versions so dependency resolution and dependency installs succeed"],"exampleFix":"// before\nchoco install appWithDeps --stop-on-first-package-failure\n// after\nchoco install theFailingDependency --verbose\n# fix that, then:\nchoco install appWithDeps","handlingStrategy":"validation","validationCode":"// Run dependency packages first and inspect their results before the dependent package.\nforeach (var dep in package.Dependencies) {\n    var depResult = choco.Install(dep.Id, dep.Version);\n    if (depResult.Success != true) { logger.Error($\"Dependency {dep.Id} failed; aborting dependent install.\"); return; }\n}","typeGuard":null,"tryCatchPattern":"try { choco.Install(config); }\ncatch (ApplicationException ex) when (ex.Message.StartsWith(\"Stopping further execution\")) {\n    // inspect results for the DependencyFailedToInstall error and fix the named dependency\n    logger.Error(ex.Message);\n}","preventionTips":["Install dependencies first and verify Success before the dependent package","Do not enable stopOnFirstPackageFailure until dependencies are known-good","Pin dependency versions to ones that install cleanly in your environment"],"tags":["dependencies","install","stop-on-first-package-failure"],"backgroundTag":null,"analyzedSha":"0d5abdd10cc177a141e69547cad6935b419b6c17","analyzedAt":"2026-08-13T18:33:03.301Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}