LykosAI/StabilityMatrix · error · ProcessException

install script failed with code

Error message

install script failed with code {Process.ExitCode}: {output.ToString().ToRepr()}

What it means

UvVenvRunner.CustomInstall runs an arbitrary install command via RunDetached, waits for exit, and throws this ProcessException when the process exit code is non-zero. All captured process output (accumulated in a StringBuilder and repr-formatted) is embedded in the message so the caller sees the script's own error text. It means the custom installation step (often a package's requirements/setup script) failed.

Solutions

  1. Read the captured output in the exception message to find the first failing step of the script.
  2. Fix the failing command/pin in the ProcessArgs passed to CustomInstall (e.g. adjust package versions).
  3. Ensure the venv is healthy and the working directory contains everything the script expects.
  4. Rerun after clearing partial install artifacts so the script starts from a clean state.

Example fix

// before: fire-and-forget install with no failure handling
await runner.CustomInstall(new ProcessArgs("install_script.sh"));
// after: capture output and handle failure
try {
    await runner.CustomInstall(new ProcessArgs("install_script.sh"), o => Console.WriteLine(o.Text));
} catch (ProcessException ex) {
    Logger.Error($"install failed: {ex.Message}");
    throw;
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (!File.Exists(runner.PythonPath)) throw new InvalidOperationException("venv not set up");

Try / catch

try { await runner.CustomInstall(args, o => log(o.Text)); }
catch (ProcessException ex) { Logger.Error($"install failed: {ex.Message}"); throw; }

Prevention

When it happens

Trigger: Calling CustomInstall(args) with a script/command that fails: syntax errors in a shell/Python script, failing pip/requirements installs inside the script, missing files the script expects, or a nonzero return from any step the script runs.

Common situations: Requirements pins incompatible with the venv's Python version; scripts assuming a working directory or tool that is absent; download failures inside setup scripts; permission errors writing into the venv.

Understand the failure class

Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.

Related errors


AI-assisted analysis of LykosAI/StabilityMatrix@af93d6ef57 (2026-09-12). Data as JSON: /api/errors/ec14900e349a0936. Report an issue: GitHub.

Appendix: source

Thrown at StabilityMatrix.Core/Python/UvVenvRunner.cs:502

        var outputAction =
            outputDataReceived == null
                ? null
                : new Action<ProcessOutput>(s =>
                {
                    Logger.Debug($"Install output: {s.Text}");
                    // Record to output
                    output.Append(s.Text);
                    // Forward to callback
                    outputDataReceived(s);
                });

        RunDetached(args, outputAction);
        await Process.WaitForExitAsync().ConfigureAwait(false);

        // Check return code
        if (Process.ExitCode != 0)
        {
            throw new ProcessException(
                $"install script failed with code {Process.ExitCode}: {output.ToString().ToRepr()}"
            );
        }
    }

    /// <summary>
    /// Run a command using the venv Python executable and return the result.
    /// </summary>
    /// <param name="arguments">Arguments to pass to the Python executable.</param>
    public async Task<ProcessResult> Run(ProcessArgs arguments)
    {
        // Record output for errors
        var output = new StringBuilder();

        var outputAction = new Action<string?>(s =>
        {
            if (s == null)
                return;

View on GitHub (pinned to af93d6ef57)