{"record":{"id":"ba453c1b7d856392","repo":"stride3d/stride","slug":"error-code-exitcode-while-running-install-package-process","errorCode":null,"errorMessage":"Error code {exitCode} while running install package process [{packageInstall}]\n\n","messagePattern":"Error code (.+?) while running install package process \\[(.+?)\\]\n\n","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"sources/assets/Stride.Core.Packages/NugetStore.cs","lineNumber":1099,"sourceCode":"            {\n                // Save errors\n                lock (process)\n                {\n                    errorOutput.AppendLine(args.Data);\n                }\n            }\n        };\n\n        // Process output and wait for exit\n        process.BeginOutputReadLine();\n        process.BeginErrorReadLine();\n        process.WaitForExit();\n\n        // Check exit code\n        var exitCode = process.ExitCode;\n        if (exitCode != 0)\n        {\n            throw new InvalidOperationException($\"Error code {exitCode} while running install package process [{packageInstall}]\\n\\n\" + errorOutput);\n        }\n    }\n\n    // Used only for Stride 1.x and 2.x\n    private void UpdateTargetsHelper()\n    {\n        if (oldRootDirectory == null)\n            return;\n\n        // Get latest package only for each MainPackageIds (up to 2.x)\n        var strideOldPackages = GetLocalPackages(\"Xenko\").Where(package => package.Tags?.Contains(\"internal\") != true).Where(x => x.Version.Version.Major < 3).ToList();\n\n        // Generate target file\n        var targetGenerator = new TargetGenerator(this, strideOldPackages, \"SiliconStudioPackage\");\n        var targetFileContent = targetGenerator.TransformText();\n        var targetFile = Path.Combine(oldRootDirectory, @\"Targets\\SiliconStudio.Common.targets\");\n\n        var targetFilePath = Path.GetDirectoryName(targetFile);","sourceCodeStart":1081,"sourceCodeEnd":1117,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/assets/Stride.Core.Packages/NugetStore.cs#L1081-L1117","documentation":"After the spawned package installer process exits, NugetStore checks process.ExitCode and throws this InvalidOperationException when it is non-zero, appending the captured stderr/stdout output so the real installer failure is visible.","triggerScenarios":"The install-package helper process runs but exits with a non-zero code (ExitCode != 0) during the store's InstallPackage flow.","commonSituations":"Installer fails due to missing dependencies or privileges; package payload corrupted; target directory locked by another process; installer itself reports a package-specific error in its output.","solutions":["Read the appended errorOutput in the exception message — it contains the installer's actual diagnostics","Rerun the install elevated / with correct permissions if the installer failed on access rights","Verify package integrity (re-download) if output indicates corruption","Close processes locking the target files (IDE, previous install) and retry"],"exampleFix":"// before\ntry { await store.Install(package); }\ncatch (InvalidOperationException) { /* no info */ }\n// after\ntry { await store.Install(package); }\ncatch (InvalidOperationException ex)\n{\n    Console.WriteLine($\"Installer failed: {ex.Message}\"); // includes exit code + output\n    // handle per installer diagnostics\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { await store.Install(package); }\ncatch (InvalidOperationException ex) when (ex.Message.StartsWith(\"Error code\"))\n{\n    var diagnostics = ex.Message; // includes installer output\n    // surface diagnostics to the user, retry with elevation if access denied\n}","preventionTips":["Always read the exception message for the captured installer output","Close apps locking target directories before installing","Run installers with sufficient privileges"],"tags":["process","nuget","installer","exit-code"],"backgroundTag":"command-not-found","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}