{"record":{"id":"b7313443c2b5b336","repo":"tinyhumansai/openhuman","slug":"branch-name-contains-invalid-characters","errorCode":null,"errorMessage":"Branch name contains invalid characters","messagePattern":"Branch name contains invalid characters","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/openhuman/tools/impl/filesystem/git_operations.rs","lineNumber":381,"sourceCode":"        args: serde_json::Value,\n    ) -> anyhow::Result<ToolResult> {\n        let branch = args\n            .get(\"branch\")\n            .and_then(|v| v.as_str())\n            .ok_or_else(|| anyhow::anyhow!(\"Missing 'branch' parameter\"))?;\n\n        // Sanitize branch name\n        let sanitized = self.sanitize_git_args(branch)?;\n\n        if sanitized.is_empty() || sanitized.len() > 1 {\n            anyhow::bail!(\"Invalid branch specification\");\n        }\n\n        let branch_name = &sanitized[0];\n\n        // Block dangerous branch names\n        if branch_name.contains('@') || branch_name.contains('^') || branch_name.contains('~') {\n            anyhow::bail!(\"Branch name contains invalid characters\");\n        }\n\n        let output = self\n            .run_git_command_in(cwd, &[\"checkout\", branch_name])\n            .await;\n\n        match output {\n            Ok(_) => Ok(ToolResult::success(format!(\n                \"Switched to branch: {branch_name}\"\n            ))),\n            Err(e) => Ok(ToolResult::error(format!(\"Checkout failed: {e}\"))),\n        }\n    }\n\n    async fn git_stash(&self, cwd: &Path, args: serde_json::Value) -> anyhow::Result<ToolResult> {\n        let action = args\n            .get(\"action\")\n            .and_then(|v| v.as_str())","sourceCodeStart":363,"sourceCodeEnd":399,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/openhuman/tools/impl/filesystem/git_operations.rs#L363-L399","documentation":"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.","triggerScenarios":"Thrown at src/openhuman/tools/impl/filesystem/git_operations.rs:381 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove the invalid character (such as '@' or control characters) from the branch name","Use plain alphanumeric, '-', '/', and '_' components in branch names"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"749120085864ce16e0f273c7b86fac7740b39c5b","analyzedAt":"2026-08-17T21:21:45.363Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}