tinyhumansai/openhuman · error

Branch name contains invalid characters

Error message

Branch name contains invalid characters

What it means

The surviving branch token contains a character (for example '@') that git can interpret specially or that is outside the accepted branch-name alphabet, so the checkout is blocked as a hardening measure even though git itself might accept it.

Source

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

        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;

        match output {
            Ok(_) => Ok(ToolResult::success(format!(
                "Switched to branch: {branch_name}"
            ))),
            Err(e) => Ok(ToolResult::error(format!("Checkout failed: {e}"))),
        }
    }

    async fn git_stash(&self, cwd: &Path, args: serde_json::Value) -> anyhow::Result<ToolResult> {
        let action = args
            .get("action")
            .and_then(|v| v.as_str())

View on GitHub (pinned to 7491200858)

Solutions

  1. Remove the invalid character (such as '@' or control characters) from the branch name
  2. Use plain alphanumeric, '-', '/', and '_' components in branch names
Defensive patterns

Strategy: validation

When it happens

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

Common situations: See trigger scenarios.

Understand the failure class


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