LykosAI/StabilityMatrix · error · ProcessException

Git command [ ] failed with exit code

Error message

Git command [{command}] failed with exit code {result.ExitCode}:
{result.StandardOutput}
{result.StandardError}

What it means

RunGit executes a git command and, if the process exits nonzero, wraps the exit code plus stdout/stderr in a ProcessException. It is the git plumbing used by clone/pull operations during package installs and updates.

Solutions

  1. Read the stdout/stderr in the exception message to see the git error, then fix the root cause (auth, URL, network).
  2. For auth failures, configure git credentials (SSH key or credential helper) for the repository host.
  3. For network issues, fix proxy/VPN/DNS settings and retry the install/update.
  4. Delete the broken clone directory and re-clone the package.
  5. Run the failing git command manually in a terminal to confirm and diagnose.
Defensive patterns

Strategy: try-catch

Validate before calling

var which = await ProcessRunner.RunBashAsync("command -v git");
if (which.ExitCode != 0) throw new Exception("git is not installed");

Try / catch

try { await helper.RunGit("pull"); }
catch (ProcessException ex)
{ logger.Error(ex, $"git failed (code {ex.ExitCodeHint}); inspect stdout/stderr in message"); }

Prevention

When it happens

Trigger: Any git invocation via RunGit returning a nonzero exit code — clone/pull of a package repo failing due to auth, network, missing git config (e.g. safe.directory), bad URL, or disk issues.

Common situations: Private repo needing credentials; offline/proxy blocking github.com; git version too old; corrupted local clone causing pull failures; SSL cert problems on corporate networks.

Understand the failure class

Background: "git command failed": what it means when a tool shells out to git and git exits non-zero — this error's family across 21 libraries.

Related errors


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

Appendix: source

Thrown at StabilityMatrix.Avalonia/Helpers/UnixPrerequisiteHelper.cs:304

            new Dictionary<string, string>
            {
                { "GIT_TERMINAL_PROMPT", "0" },
                // Set UTF-8 locale to handle Unicode characters in paths
                { "LC_ALL", "C.UTF-8" },
                { "LANG", "C.UTF-8" },
            }
        );
        if (result.ExitCode != 0)
        {
            Logger.Error(
                "Git command [{Command}] failed with exit code " + "{ExitCode}:\n{StdOut}\n{StdErr}",
                command,
                result.ExitCode,
                result.StandardOutput,
                result.StandardError
            );

            throw new ProcessException(
                $"Git command [{command}] failed with exit code"
                    + $" {result.ExitCode}:\n{result.StandardOutput}\n{result.StandardError}"
            );
        }
    }

    public async Task InstallPythonIfNecessary(IProgress<ProgressReport>? progress = null)
    {
        await InstallPythonIfNecessary(PyInstallationManager.DefaultVersion, progress);
    }

    public async Task InstallPythonIfNecessary(PyVersion version, IProgress<ProgressReport>? progress = null)
    {
        var pythonDir = GetPythonDir(version);

        if (IsPythonVersionInstalled(version))
            return;

View on GitHub (pinned to af93d6ef57)