{
  "id": "go/goroutine-select-on-nil-channels",
  "signature": "fatal error: all goroutines are asleep - deadlock! (select on nil channels)",
  "signature_zh": "致命错误：所有协程都处于睡眠状态 - 死锁！（在nil通道上select）",
  "regex": "fatal\\ error:\\ all\\ goroutines\\ are\\ asleep\\ \\-\\ deadlock!\\ \\(select\\ on\\ nil\\ channels\\)",
  "domain": "go",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "A select statement with all nil channels blocks forever, as nil channels never become ready.",
  "root_cause_type": "generic",
  "root_cause_zh": "所有通道都为nil的select语句永远阻塞，因为nil通道永远不会就绪。",
  "versions": [
    {
      "version": "1.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.22",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Adding a default case that does nothing",
      "why_fails": "Default case executes immediately, but if omitted, all-nil select blocks.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "Using time.After in select",
      "why_fails": "time.After returns a non-nil channel, so select won't have all nil channels.",
      "fail_rate": 0.4,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Always include a default case or non-nil channel in select",
      "success_rate": 0.95,
      "how": "select {\ncase <-ch1:\ncase <-ch2:\ndefault:\n    // avoid deadlock\n}",
      "condition": "",
      "sources": []
    },
    {
      "action": "Ensure at least one channel is non-nil before select",
      "success_rate": 0.9,
      "how": "if ch1 == nil && ch2 == nil {\n    return // or handle\n}\nselect {\ncase <-ch1:\ncase <-ch2:\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.83,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-05-12",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}