{"record":{"id":"ec14900e349a0936","repo":"LykosAI/StabilityMatrix","slug":"install-script-failed-with-code-process-exitcode-output-ec1490","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/UvVenvRunner.cs","lineNumber":502,"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":484,"sourceCodeEnd":520,"githubUrl":"https://github.com/LykosAI/StabilityMatrix/blob/af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002/StabilityMatrix.Core/Python/UvVenvRunner.cs#L484-L520","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the captured output in the exception message to find the first failing step of the script.","Fix the failing command/pin in the ProcessArgs passed to CustomInstall (e.g. adjust package versions).","Ensure the venv is healthy and the working directory contains everything the script expects.","Rerun after clearing partial install artifacts so the script starts from a clean state."],"exampleFix":"// before: fire-and-forget install with no failure handling\nawait runner.CustomInstall(new ProcessArgs(\"install_script.sh\"));\n// after: capture output and handle failure\ntry {\n    await runner.CustomInstall(new ProcessArgs(\"install_script.sh\"), o => Console.WriteLine(o.Text));\n} catch (ProcessException ex) {\n    Logger.Error($\"install failed: {ex.Message}\");\n    throw;\n}","handlingStrategy":"try-catch","validationCode":"if (!File.Exists(runner.PythonPath)) throw new InvalidOperationException(\"venv not set up\");","typeGuard":null,"tryCatchPattern":"try { await runner.CustomInstall(args, o => log(o.Text)); }\ncatch (ProcessException ex) { Logger.Error($\"install failed: {ex.Message}\"); throw; }","preventionTips":["Stream output via the outputDataReceived callback to see failures live.","Test install scripts standalone before wiring them into CustomInstall.","Clean partial artifacts before retrying so scripts start fresh."],"tags":["python","process","install-script","exit-code"],"backgroundTag":"http-error-response","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"}