{
  "id": "go/all-goroutines-asleep-deadlock",
  "signature": "fatal error: all goroutines are asleep - deadlock!",
  "signature_zh": "fatal error: 所有 goroutine 都处于休眠状态 - 死锁！",
  "regex": "fatal\\ error:\\ all\\ goroutines\\ are\\ asleep\\ \\-\\ deadlock!",
  "domain": "go",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "Every goroutine is blocked on a channel operation, mutex, or WaitGroup with no runnable goroutine to unblock them. The runtime detects total quiescence and aborts.",
  "root_cause_type": "generic",
  "root_cause_zh": "所有 goroutine 都阻塞在 channel 操作、互斥锁或 WaitGroup 上，没有任何可运行的 goroutine 能解除阻塞。运行时检测到完全静止后终止程序。",
  "versions": [
    {
      "version": "1.0+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Timeout converts the deadlock into a silent timeout error, hiding the missing sender/receiver. The program still fails to make progress.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "If no receiver ever reads, buffering only delays the deadlock; once the buffer fills, the sender blocks again.",
      "fail_rate": 0.75,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.93,
      "how": "ch := make(chan int)\ndone := make(chan struct{})\ngo func() { defer close(done); for v := range ch { _ = v } }()\nfor i := 0; i < 10; i++ { ch <- i }\nclose(ch)\n<-done",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.88,
      "how": "// runtime: kill -QUIT <pid> or send SIGQUIT; inspect 'goroutine N [chan send/receive]' lines",
      "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.9,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-07-02",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}