{
  "id": "git/cannot-delete-branch-checked-out",
  "signature": "error: Cannot delete branch 'main' checked out at '/path/to/repo'",
  "signature_zh": "错误：无法删除在 '/path/to/repo' 检出的分支 'main'",
  "regex": "^error: Cannot delete branch '.+' checked out at '.+'$",
  "domain": "git",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "Attempting to delete the currently checked-out branch in a Git repository.",
  "root_cause_type": "generic",
  "root_cause_zh": "尝试删除当前 Git 仓库中已检出的分支。",
  "versions": [
    {
      "version": "git 2.30",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "git 2.39",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "git 2.45",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Force delete (-D) also fails on the currently checked-out branch; Git refuses to delete a branch that is active.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The branch is still checked out in the current working tree; Git checks the repository state, not just the session.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Switch to another branch (e.g., 'main' or 'develop') before deleting: git checkout other-branch && git branch -D main",
      "success_rate": 0.95,
      "how": "Switch to another branch (e.g., 'main' or 'develop') before deleting: git checkout other-branch && git branch -D main",
      "condition": "",
      "sources": []
    },
    {
      "action": "If the branch is not needed, force delete from a different worktree or after detaching HEAD: git checkout --detach && git branch -D main",
      "success_rate": 0.85,
      "how": "If the branch is not needed, force delete from a different worktree or after detaching HEAD: git checkout --detach && git branch -D main",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Switch to another branch (e.g., 'main' or 'develop') before deleting: git checkout other-branch && git branch -D main",
    "If the branch is not needed, force delete from a different worktree or after detaching HEAD: git checkout --detach && git branch -D main"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://git-scm.com/docs/git-branch#Documentation/git-branch.txt---delete",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.9,
  "resolvable": "true",
  "first_seen": "2023-03-12",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}