tinyhumansai/openhuman · error

Git command failed: {stderr}

Error message

Git command failed: {stderr}

What it means

The spawned git process completed but exited non-zero; this message wraps git's own stderr as the failure reason. It reports a repository-level problem (bad revision, nothing to commit, merge conflict, missing object), not a failure to launch git.

Source

Thrown at src/openhuman/tools/impl/filesystem/git_operations.rs:101

    /// Check if an operation is read-only
    fn is_read_only(&self, operation: &str) -> bool {
        matches!(
            operation,
            "status" | "diff" | "log" | "show" | "branch" | "rev-parse"
        )
    }

    async fn run_git_command_in(&self, cwd: &Path, args: &[&str]) -> anyhow::Result<String> {
        let output = tokio::process::Command::new("git")
            .args(args)
            .current_dir(cwd)
            .output()
            .await?;

        if !output.status.success() {
            let stderr = String::from_utf8_lossy(&output.stderr);
            anyhow::bail!("Git command failed: {stderr}");
        }

        Ok(String::from_utf8_lossy(&output.stdout).to_string())
    }

    async fn git_status(&self, cwd: &Path, _args: serde_json::Value) -> anyhow::Result<ToolResult> {
        let output = self
            .run_git_command_in(cwd, &["status", "--porcelain=2", "--branch"])
            .await?;

        // Parse git status output into structured format
        let mut result = serde_json::Map::new();
        let mut branch = String::new();
        let mut staged = Vec::new();
        let mut unstaged = Vec::new();
        let mut untracked = Vec::new();

        for line in output.lines() {

View on GitHub (pinned to 7491200858)

Solutions

  1. Read the embedded git stderr to identify the failing operation
  2. For 'nothing to commit' stage changes first or skip the commit
  3. For bad revisions or conflicts, verify branch names and resolve the repository state before retrying
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/openhuman/tools/impl/filesystem/git_operations.rs:101 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of tinyhumansai/openhuman@7491200858 (2026-08-17). Data as JSON: /api/errors/fa56078a15990d28. Report an issue: GitHub.