LykosAI/StabilityMatrix · error · ProcessException

install script failed with code

Error message

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

What it means

CustomInstall runs an arbitrary install script via RunDetached and waits for exit; if the process exits non-zero it throws ProcessException including the exit code and a repr of all captured output. It signals the external installer script failed, not the library itself.

Solutions

  1. Read the captured output in the exception message for the script's own error.
  2. Run the script manually with the venv's environment to reproduce and fix the underlying cause.
  3. Verify script dependencies (git, compiler, network) are present.
  4. Ensure the script is executable and matches the current platform.

Example fix

// before
await venv.CustomInstall("webui.sh", outputAction);
// after
try { await venv.CustomInstall("webui.sh", outputAction); }
catch (ProcessException ex) { Logger.Error(ex, "installer failed"); throw new LaunchOperationFailedException("...", ex); }
Defensive patterns

Strategy: try-catch

Validate before calling

if (!OperatingSystem.IsWindows() && !IsExecutable(scriptPath)) throw new InvalidOperationException("script not executable");

Try / catch

try { await venv.CustomInstall(script, outputAction); }
catch (ProcessException ex) { Logger.Error(ex, "install script failed"); throw new LaunchOperationFailedException("Install failed", ex); }

Prevention

When it happens

Trigger: Calling CustomInstall(scriptPath) where the script returns non-zero: bad args, missing dependencies inside the script, network failure during the script, unsupported platform branch.

Common situations: WebUI/extension installers (e.g. A1111 webui.sh) failing on missing git or CUDA toolkits; scripts requiring interactive input; running a Windows .bat through a Unix shell.

Related errors


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

Appendix: source

Thrown at StabilityMatrix.Core/Python/PyVenvRunner.cs:485

        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)