{
  "id": "go/select-on-empty-nil-channel",
  "signature": "fatal error: all goroutines are asleep - deadlock! (select on nil channel)",
  "signature_zh": "fatal error: 所有 goroutine 都处于休眠状态 - 死锁！（在 nil channel 上 select）",
  "regex": "fatal\\ error:\\ all\\ goroutines\\ are\\ asleep\\ \\-\\ deadlock!\\ \\(select\\ on\\ nil\\ channel\\)",
  "domain": "go",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "A select with only nil channels (or a single nil channel) blocks forever because nil channels are never ready. Common when a channel is conditionally assigned nil to disable a case.",
  "root_cause_type": "generic",
  "root_cause_zh": "select 中只有 nil channel（或单个 nil channel）会永久阻塞，因为 nil channel 永不就绪。常见于条件性地将 channel 赋值为 nil 以禁用某个 case。",
  "versions": [
    {
      "version": "1.0+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Turns the deadlock into a busy loop, pegging CPU and never making progress.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Unbuffered channel still blocks if no sender; same deadlock.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "select {\ncase v := <-ch:\n    handle(v)\ncase <-ctx.Done():\n    return ctx.Err()\n}",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.92,
      "how": "if ch == nil { return ErrNoChannel }\nselect { case v := <-ch: _ = v }",
      "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.87,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-05-21",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}