{
  "id": "go/sync-unlock-of-unlocked-mutex",
  "signature": "fatal error: sync: unlock of unlocked mutex",
  "signature_zh": "fatal error: sync: 解锁未加锁的互斥锁",
  "regex": "fatal\\ error:\\ sync:\\ unlock\\ of\\ unlocked\\ mutex",
  "domain": "go",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "mu.Unlock() is called without a matching Lock(), often due to a double unlock or an early Unlock in a defer plus explicit Unlock.",
  "root_cause_type": "generic",
  "root_cause_zh": "在没有对应 Lock() 的情况下调用 mu.Unlock()，常因双重解锁或 defer Unlock 与显式 Unlock 叠加。",
  "versions": [
    {
      "version": "1.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "This is a fatal error; recover cannot catch it.",
      "fail_rate": 1.0,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The flag itself needs synchronization and often races.",
      "fail_rate": 0.75,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "mu.Lock()\ndefer mu.Unlock()\n// no other Unlock calls",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.93,
      "how": "func (s *Store) withLock(fn func()) {\n    s.mu.Lock()\n    defer s.mu.Unlock()\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.89,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-10-04",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}