LykosAI/StabilityMatrix · error · InvalidOperationException
Failed to start Forge Classic install process
Error message
Failed to start Forge Classic install process
What it means
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.
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.
Defensive patterns
Strategy: try-catch
Validate before calling
var venvPython = Path.Combine(installLocation, "venv", OperatingSystem.IsWindows() ? "Scripts\\python.exe" : "bin/python");
if (!File.Exists(venvPython)) { /* recreate venv before installing */ } Try / catch
try { await package.InstallPackage(...); }
catch (InvalidOperationException ex) when (ex.Message.Contains("Failed to start"))
{ RecreateVenvAndRetry(); } Prevention
- 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
When it happens
Trigger: InstallPackage -> RunInstallScriptWithPromptHandling calls RunDetached with launch args and the process fails to start (venv python executable missing, path too long, permissions, corrupted venv).
Common situations: Venv was deleted or corrupted mid-install; antivirus blocks python.exe; invalid python version chosen so the venv interpreter path doesn't exist.
Related errors
- Torch is not installed in the virtual environment.
- ComfyUI venv was not found at
- Windows ROCm bitsandbytes is only supported on Python 3.12.x
- pyvenv.cfg is UTF-16 encoded; expected UTF-8/ASCII
- pyvenv.cfg contains NUL bytes; expected UTF-8/ASCII
AI-assisted analysis of LykosAI/StabilityMatrix@af93d6ef57 (2026-09-12).
Data as JSON: /api/errors/1b8de1ea49b44da5.
Report an issue: GitHub.
Appendix: source
Thrown at StabilityMatrix.Core/Models/Packages/ForgeClassic.cs:342
venvRunner.Process.StandardInput.WriteLine();
enterSent = true;
onConsoleOutput?.Invoke(
ProcessOutput.FromStdOutLine(
"[ForgeClassic] Detected legacy update prompt. Sent Enter automatically."
)
);
}
catch (Exception e)
{
Logger.Warn(e, "Failed to auto-submit Enter for Forge Classic update prompt");
}
}
venvRunner.RunDetached([.. launchArgs], HandleInstallOutput);
var process =
venvRunner.Process
?? throw new InvalidOperationException("Failed to start Forge Classic install process");
await process.WaitForExitAsync(cancellationToken).ConfigureAwait(false);
return process.ExitCode;
}
private void ResetVenvForPythonUpgrade(string installLocation, Action<ProcessOutput>? onConsoleOutput)
{
var venvPath = Path.Combine(installLocation, "venv");
if (!Directory.Exists(venvPath))
return;
try
{
Directory.Delete(venvPath, recursive: true);
onConsoleOutput?.Invoke(
ProcessOutput.FromStdOutLine("[ForgeClassic] Removed existing venv before Python upgrade.")
);
}
catch (Exception e)View on GitHub (pinned to af93d6ef57)