{
  "id": "go/channel-receive-from-closed-channel-ok",
  "signature": "fatal error: all goroutines are asleep - deadlock! (receive from closed channel)",
  "signature_zh": "fatal error: 所有 goroutine 都休眠了 - 死锁！（从已关闭的 channel 接收）",
  "regex": "fatal\\ error:\\ all\\ goroutines\\ are\\ asleep\\ \\-\\ deadlock!\\ \\(receive\\ from\\ closed\\ channel\\)",
  "domain": "go",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "A goroutine is blocked receiving from a channel that is closed and empty, but other goroutines are also blocked, leading to a deadlock.",
  "root_cause_type": "generic",
  "root_cause_zh": "某个 goroutine 阻塞在从已关闭且为空的 channel 接收数据，而其他 goroutine 也处于阻塞状态，导致死锁。",
  "versions": [
    {
      "version": "1.0+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Sleep does not unblock a deadlock; it only delays the inevitable fatal error",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The deadlock is logical, not related to parallelism",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "v, ok := <-ch\nif !ok {\n    return\n}",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.98,
      "how": "for v := range ch {\n    // process v\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.9,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-05-20",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}