{
  "id": "go/goroutine-nil-channel-block",
  "signature": "fatal error: all goroutines are asleep - deadlock! (nil channel)",
  "signature_zh": "致命错误：所有协程都处于睡眠状态 - 死锁！（nil通道）",
  "regex": "fatal\\ error:\\ all\\ goroutines\\ are\\ asleep\\ \\-\\ deadlock!\\ \\(nil\\ channel\\)",
  "domain": "go",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "Sending to or receiving from a nil channel blocks forever, causing deadlock if all goroutines are stuck.",
  "root_cause_type": "generic",
  "root_cause_zh": "向nil通道发送或从nil通道接收会永远阻塞，如果所有协程都卡住会导致死锁。",
  "versions": [
    {
      "version": "1.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.20",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Checking channel with if ch != nil before operation",
      "why_fails": "Nil check is correct but often omitted due to oversight; still a logic error.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    },
    {
      "action": "Using recover() to handle panic from nil channel",
      "why_fails": "Nil channel doesn't panic; it blocks forever, so recover is useless.",
      "fail_rate": 1.0,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Initialize channel before use",
      "success_rate": 0.99,
      "how": "var ch chan int\nch = make(chan int)\nch <- 42 // safe",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use select with default to avoid blocking on nil channel",
      "success_rate": 0.85,
      "how": "select {\ncase ch <- val:\ndefault:\n    // handle nil or full channel\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.85,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-03-10",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}