LykosAI/StabilityMatrix · error · ProcessException
Process failed with exit-code .
Error message
Process {processName} failed with exit-code {process.ExitCode}. What it means
ProcessRunner.WaitForExitConditionAsync throws ProcessException when the spawned process exits with a non-success (non-zero) exit code. It includes the process name and exit code to identify which external tool failed.
Solutions
- Read the process's captured stdout/stderr output to see the underlying error message.
- Re-run the command manually in a terminal to reproduce and diagnose.
- Fix the environment the process runs in (dependencies, paths, permissions).
- Handle ProcessException in the caller and surface process output to the user.
- Ensure ProcessStartInfo redirects output so diagnostics are available.
Example fix
// before
await processRunner.WaitForExitConditionAsync(process); // throws on non-zero exit
// after
try
{
await processRunner.WaitForExitConditionAsync(process);
}
catch (ProcessException ex)
{
_logger.LogError("Process failed: {Message}\nStderr: {Stderr}", ex.Message, processOutput.Stderr);
throw;
} Defensive patterns
Strategy: try-catch
Validate before calling
// Verify the executable and environment before launching
if (!File.Exists( exePath )) throw new FileNotFoundException("Executable missing", exePath);
if (process.StartInfo.RedirectStandardError == false)
process.StartInfo.RedirectStandardError = true; // ensure diagnostics are captured Try / catch
try { await processRunner.WaitForExitConditionAsync(process); }
catch (ProcessException ex)
{
_logger.LogError(ex, "Process exited with code {Code}; stderr: {Stderr}",
process.ExitCode, stderrBuilder.ToString());
throw;
} Prevention
- Always redirect stdout/stderr so failure output is available for diagnosis
- Validate the external environment (python version, packages, paths) before launching
- Set working directory and env vars explicitly on ProcessStartInfo
- Surface process output to users when a ProcessException occurs
- Test child-process commands manually after environment updates
When it happens
Trigger: Any child process launched and awaited via ProcessRunner (e.g. python, pip, git, model tools) terminating with a non-zero exit code.
Common situations: Missing Python packages, script exceptions, insufficient permissions, bad CLI arguments, out-of-disk during model operations, incompatible environment versions.
Related errors
- install script failed with code
- Install script failed with exit code
- Venv creation failed with code
- pip install failed with code
- pip list failed with code
AI-assisted analysis of LykosAI/StabilityMatrix@af93d6ef57 (2026-09-12).
Data as JSON: /api/errors/3cf690e69ac454d0.
Report an issue: GitHub.
Appendix: source
Thrown at StabilityMatrix.Core/Processes/ProcessRunner.cs:696
if (!process.HasExited)
{
await process.WaitForExitAsync(cancelToken).ConfigureAwait(false);
}
if (process.ExitCode == expectedExitCode)
{
return;
}
// Accessing ProcessName may error on some platforms
string? processName = null;
try
{
processName = process.ProcessName;
}
catch (SystemException) { }
throw new ProcessException(
"Process "
+ (processName == null ? "" : processName + " ")
+ $"failed with exit-code {process.ExitCode}."
);
}
}
View on GitHub (pinned to af93d6ef57)