{"record":{"id":"2c015f7c9af0fdb8","repo":"tinyhumansai/openhuman","slug":"invalid-branch-specification","errorCode":null,"errorMessage":"Invalid branch specification","messagePattern":"Invalid branch specification","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/openhuman/tools/impl/filesystem/git_operations.rs","lineNumber":374,"sourceCode":"            Err(e) => Ok(ToolResult::error(format!(\"Add failed: {e}\"))),\n        }\n    }\n\n    async fn git_checkout(\n        &self,\n        cwd: &Path,\n        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}\"))),","sourceCodeStart":356,"sourceCodeEnd":392,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/openhuman/tools/impl/filesystem/git_operations.rs#L356-L392","documentation":"After sanitization, the branch parameter did not reduce to exactly one clean token — it is either empty or split into multiple whitespace-separated pieces — so it cannot be used as a single branch name for checkout.","triggerScenarios":"Thrown at src/openhuman/tools/impl/filesystem/git_operations.rs:374 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a single branch name with no spaces, e.g. 'feature/x'","Quote the value correctly in the JSON arguments so it arrives as one string"],"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-14T05:17:10.506Z"}