{
  "id": "go/panic-sync-unlock-of-unlocked-mutex",
  "signature": "panic: sync: unlock of unlocked mutex",
  "signature_zh": "恐慌：sync: 解锁未锁定的互斥锁",
  "regex": "panic:\\ sync:\\ unlock\\ of\\ unlocked\\ mutex",
  "domain": "go",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "sync.Mutex.Unlock() is called on a mutex that is not currently locked, often due to double Unlock or a missing Lock.",
  "root_cause_type": "generic",
  "root_cause_zh": "对当前未锁定的互斥锁调用 sync.Mutex.Unlock()，通常是由于重复 Unlock 或缺少 Lock。",
  "versions": [
    {
      "version": "1.18",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.21",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Hides the bug but does not fix the incorrect locking logic; may cause deadlocks later.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Channels have different semantics and may not fit the use case; also more complex.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "Use defer mu.Unlock() immediately after Lock() to ensure pairing:\nmu.Lock()\ndefer mu.Unlock()",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "Review all Lock/Unlock pairs and ensure they are balanced. Consider using sync.RWMutex if read-heavy.",
      "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-01-30",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}