tinyhumansai/openhuman · error

Missing 'branch' parameter

Error message

Missing 'branch' parameter

What it means

Git tool argument guard inside git_checkout: the required 'branch' argument is missing or not a string. Fires before the checkout command is built.

Source

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

        self.sanitize_git_args(paths)?;

        let output = self.run_git_command_in(cwd, &["add", "--", paths]).await;

        match output {
            Ok(_) => Ok(ToolResult::success(format!("Staged: {paths}"))),
            Err(e) => Ok(ToolResult::error(format!("Add failed: {e}"))),
        }
    }

    async fn git_checkout(
        &self,
        cwd: &Path,
        args: serde_json::Value,
    ) -> anyhow::Result<ToolResult> {
        let branch = args
            .get("branch")
            .and_then(|v| v.as_str())
            .ok_or_else(|| anyhow::anyhow!("Missing 'branch' parameter"))?;

        // Sanitize branch name
        let sanitized = self.sanitize_git_args(branch)?;

        if sanitized.is_empty() || sanitized.len() > 1 {
            anyhow::bail!("Invalid branch specification");
        }

        let branch_name = &sanitized[0];

        // Block dangerous branch names
        if branch_name.contains('@') || branch_name.contains('^') || branch_name.contains('~') {
            anyhow::bail!("Branch name contains invalid characters");
        }

        let output = self
            .run_git_command_in(cwd, &["checkout", branch_name])
            .await;

View on GitHub (pinned to 7491200858)

Solutions

  1. Pass 'branch' as the branch name string
  2. List branches first to copy the exact name
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/openhuman/tools/impl/filesystem/git_operations.rs:368 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/7d59b318b2cfa7cb. Report an issue: GitHub.