{"record":{"id":"1b8de1ea49b44da5","repo":"LykosAI/StabilityMatrix","slug":"failed-to-start-forge-classic-install-process","errorCode":null,"errorMessage":"Failed to start Forge Classic install process","messagePattern":"Failed to start Forge Classic install process","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"StabilityMatrix.Core/Models/Packages/ForgeClassic.cs","lineNumber":342,"sourceCode":"                venvRunner.Process.StandardInput.WriteLine();\n                enterSent = true;\n\n                onConsoleOutput?.Invoke(\n                    ProcessOutput.FromStdOutLine(\n                        \"[ForgeClassic] Detected legacy update prompt. Sent Enter automatically.\"\n                    )\n                );\n            }\n            catch (Exception e)\n            {\n                Logger.Warn(e, \"Failed to auto-submit Enter for Forge Classic update prompt\");\n            }\n        }\n\n        venvRunner.RunDetached([.. launchArgs], HandleInstallOutput);\n        var process =\n            venvRunner.Process\n            ?? throw new InvalidOperationException(\"Failed to start Forge Classic install process\");\n        await process.WaitForExitAsync(cancellationToken).ConfigureAwait(false);\n        return process.ExitCode;\n    }\n\n    private void ResetVenvForPythonUpgrade(string installLocation, Action<ProcessOutput>? onConsoleOutput)\n    {\n        var venvPath = Path.Combine(installLocation, \"venv\");\n        if (!Directory.Exists(venvPath))\n            return;\n\n        try\n        {\n            Directory.Delete(venvPath, recursive: true);\n            onConsoleOutput?.Invoke(\n                ProcessOutput.FromStdOutLine(\"[ForgeClassic] Removed existing venv before Python upgrade.\")\n            );\n        }\n        catch (Exception e)","sourceCodeStart":324,"sourceCodeEnd":360,"githubUrl":"https://github.com/LykosAI/StabilityMatrix/blob/af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002/StabilityMatrix.Core/Models/Packages/ForgeClassic.cs#L324-L360","documentation":"RunInstallScriptWithPromptHandling throws InvalidOperationException when venvRunner.RunDetached is called but venvRunner.Process is null, meaning the venv python process could not be spawned. This is a process-start failure, not a script failure.","triggerScenarios":"InstallPackage -> RunInstallScriptWithPromptHandling calls RunDetached with launch args and the process fails to start (venv python executable missing, path too long, permissions, corrupted venv).","commonSituations":"Venv was deleted or corrupted mid-install; antivirus blocks python.exe; invalid python version chosen so the venv interpreter path doesn't exist.","solutions":["Recreate the venv (reinstall the package or delete the venv folder) so the python executable exists.","Verify the selected Python version is actually downloaded/available in Stability Matrix's python install directory.","Check antivirus/quarantine logs for blocked python.exe and whitelist the Stability Matrix directories.","Retry the install; transient file locks (Forge still running) can prevent process start."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"var venvPython = Path.Combine(installLocation, \"venv\", OperatingSystem.IsWindows() ? \"Scripts\\\\python.exe\" : \"bin/python\");\nif (!File.Exists(venvPython)) { /* recreate venv before installing */ }","typeGuard":null,"tryCatchPattern":"try { await package.InstallPackage(...); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"Failed to start\"))\n{ RecreateVenvAndRetry(); }","preventionTips":["Never delete or lock the venv folder while an install is running","Whitelist Stability Matrix paths in antivirus","Confirm the selected Python version is downloaded before installing"],"tags":["process-start","venv","python"],"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"}