{"record":{"id":"c5614bc21a4776c1","repo":"LykosAI/StabilityMatrix","slug":"install-script-failed-with-code-process-exitcode-output","errorCode":null,"errorMessage":"install script failed with code {Process.ExitCode}: {output.ToString().ToRepr()}","messagePattern":"install script failed with code (.+?): (.+?)","errorType":"exception","errorClass":"ProcessException","httpStatus":null,"severity":"error","filePath":"StabilityMatrix.Core/Python/PyVenvRunner.cs","lineNumber":485,"sourceCode":"        var outputAction =\n            outputDataReceived == null\n                ? null\n                : new Action<ProcessOutput>(s =>\n                {\n                    Logger.Debug($\"Install output: {s.Text}\");\n                    // Record to output\n                    output.Append(s.Text);\n                    // Forward to callback\n                    outputDataReceived(s);\n                });\n\n        RunDetached(args, outputAction);\n        await Process.WaitForExitAsync().ConfigureAwait(false);\n\n        // Check return code\n        if (Process.ExitCode != 0)\n        {\n            throw new ProcessException(\n                $\"install script failed with code {Process.ExitCode}: {output.ToString().ToRepr()}\"\n            );\n        }\n    }\n\n    /// <summary>\n    /// Run a command using the venv Python executable and return the result.\n    /// </summary>\n    /// <param name=\"arguments\">Arguments to pass to the Python executable.</param>\n    public async Task<ProcessResult> Run(ProcessArgs arguments)\n    {\n        // Record output for errors\n        var output = new StringBuilder();\n\n        var outputAction = new Action<string?>(s =>\n        {\n            if (s == null)\n                return;","sourceCodeStart":467,"sourceCodeEnd":503,"githubUrl":"https://github.com/LykosAI/StabilityMatrix/blob/af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002/StabilityMatrix.Core/Python/PyVenvRunner.cs#L467-L503","documentation":"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.","triggerScenarios":"Calling CustomInstall(scriptPath) where the script returns non-zero: bad args, missing dependencies inside the script, network failure during the script, unsupported platform branch.","commonSituations":"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.","solutions":["Read the captured output in the exception message for the script's own error.","Run the script manually with the venv's environment to reproduce and fix the underlying cause.","Verify script dependencies (git, compiler, network) are present.","Ensure the script is executable and matches the current platform."],"exampleFix":"// before\nawait venv.CustomInstall(\"webui.sh\", outputAction);\n// after\ntry { await venv.CustomInstall(\"webui.sh\", outputAction); }\ncatch (ProcessException ex) { Logger.Error(ex, \"installer failed\"); throw new LaunchOperationFailedException(\"...\", ex); }","handlingStrategy":"try-catch","validationCode":"if (!OperatingSystem.IsWindows() && !IsExecutable(scriptPath)) throw new InvalidOperationException(\"script not executable\");","typeGuard":null,"tryCatchPattern":"try { await venv.CustomInstall(script, outputAction); }\ncatch (ProcessException ex) { Logger.Error(ex, \"install script failed\"); throw new LaunchOperationFailedException(\"Install failed\", ex); }","preventionTips":["Log full outputAction output for post-mortem","Verify script prerequisites (git, toolchain) before running","Run scripts non-interactively with all required args"],"tags":["python","subprocess","install-script","process-exception"],"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"}