{"record":{"id":"d4d8784b88cabbdf","repo":"LykosAI/StabilityMatrix","slug":"install-script-failed-with-exit-code-exitcode","errorCode":null,"errorMessage":"Install script failed with exit code {exitCode}","messagePattern":"Install script failed with exit code (.+?)","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"StabilityMatrix.Core/Models/Packages/ForgeClassic.cs","lineNumber":279,"sourceCode":"                onConsoleOutput?.Invoke(\n                    ProcessOutput.FromStdOutLine(\n                        \"[ForgeClassic] Retrying install after backing up legacy config files...\"\n                    )\n                );\n\n                exitCode = await RunInstallScriptWithPromptHandling(\n                        venvRunner,\n                        launchArgs,\n                        onConsoleOutput,\n                        cancellationToken\n                    )\n                    .ConfigureAwait(false);\n            }\n        }\n\n        if (exitCode != 0)\n        {\n            throw new InvalidOperationException($\"Install script failed with exit code {exitCode}\");\n        }\n\n        if (\n            !string.Equals(\n                installedPackage.PythonVersion,\n                targetPythonVersion.StringValue,\n                StringComparison.Ordinal\n            )\n        )\n        {\n            installedPackage.PythonVersion = targetPythonVersion.StringValue;\n        }\n\n        progress?.Report(new ProgressReport(1f, \"Install complete\", isIndeterminate: false));\n    }\n\n    private async Task<int> RunInstallScriptWithPromptHandling(\n        IPyVenvRunner venvRunner,","sourceCodeStart":261,"sourceCodeEnd":297,"githubUrl":"https://github.com/LykosAI/StabilityMatrix/blob/af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002/StabilityMatrix.Core/Models/Packages/ForgeClassic.cs#L261-L297","documentation":"ForgeClassic.InstallPackage throws InvalidOperationException when the venv-launched install script (pip/requirements setup) finishes with a nonzero exit code. It signals the installation script failed partway and the package should be considered not correctly installed.","triggerScenarios":"InstallPackage runs the install script via RunInstallScriptWithPromptHandling; the detached process exits with exitCode != 0 (pip resolution failure, network error, missing requirements, python version incompatibility).","commonSituations":"PyTorch/dependency wheels fail to download; requirements pin incompatible with the chosen Python version; antivirus or file locks interrupt the venv writes.","solutions":["Scroll back in the install log for the actual pip error; fix that root cause (network, disk space, dependency conflict) and reinstall.","Retry the install after deleting the package's venv so a clean environment is created.","Choose a different Python version for the package (e.g. 3.10/3.11) if the requirements fail to resolve.","Check disk space and proxy/firewall settings that may block package downloads."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// verify disk space, network reachability, and chosen python version before InstallPackage\nif (!HasEnoughDiskSpace(installLocation, requiredGb: 10)) return;","typeGuard":null,"tryCatchPattern":"try { await package.InstallPackage(...); }\ncatch (InvalidOperationException ex) when (ex.Message.StartsWith(\"Install script failed\"))\n{ ShowInstallLogAndOfferRetry(); }","preventionTips":["Read the full install log for the underlying pip error before retrying","Pick a Python version compatible with the package's requirements","Ensure stable network/proxy access to PyPI and torch indexes"],"tags":["install-script","exit-code","pip","venv"],"backgroundTag":"command-not-found","analyzedSha":"af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002","analyzedAt":"2026-09-12T19:02:43.389Z","contentChangedAt":"2026-09-12T19:02:43.389Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}