{
  "id": "go/mutex-lock-of-locked",
  "signature": "fatal error: sync: RUnlock of unlocked RWMutex",
  "signature_zh": "fatal error: sync: 解锁未锁定的 RWMutex",
  "regex": "fatal\\ error:\\ sync:\\ RUnlock\\ of\\ unlocked\\ RWMutex",
  "domain": "go",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "RWMutex.RUnlock() called without a matching RLock, often from a defer in a branch that never took the read lock, or from a panic path that skipped RLock.",
  "root_cause_type": "generic",
  "root_cause_zh": "RWMutex.RUnlock() 在没有匹配 RLock 的情况下被调用，常见于未获取读锁的分支中的 defer，或跳过 RLock 的 panic 路径。",
  "versions": [
    {
      "version": "1.0+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "The mismatched Unlock remains and now triggers 'unlock of unlocked mutex' instead.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "More error-prone; panics now leave the lock held, causing deadlocks.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.96,
      "how": "func read() {\n    mu.RLock()\n    defer mu.RUnlock()\n    // read-only work\n}",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.94,
      "how": "func withRLock(mu *sync.RWMutex, fn func()) {\n    mu.RLock()\n    defer mu.RUnlock()\n    fn()\n}",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": null,
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.88,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-04-02",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}