{
  "id": "go/select-no-case-ready-blocks-forever",
  "signature": "fatal error: all goroutines are asleep - deadlock!\ngoroutine 1 [select (no cases)]:",
  "signature_zh": "致命错误：所有 goroutine 处于休眠状态 - 死锁！\ngoroutine 1 [select (no cases)]：",
  "regex": "fatal\\ error:\\ all\\ goroutines\\ are\\ asleep\\ \\-\\ deadlock!\\\ngoroutine\\ 1\\ \\[select\\ \\(no\\ cases\\)\\]:",
  "domain": "go",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "A select statement has no ready cases and no default, blocking forever. If it's the only runnable goroutine, the runtime reports deadlock.",
  "root_cause_type": "generic",
  "root_cause_zh": "select 语句没有就绪的 case 也没有 default，永久阻塞。如果它是唯一可运行的 goroutine，运行时会报告死锁。",
  "versions": [
    {
      "version": "1.0+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Turns a blocking wait into a busy loop that spins CPU at 100%.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Polling with sleeps adds latency and still misses events under load.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.92,
      "how": "select {\ncase v := <-ch:\n    return v\ncase <-time.After(5 * time.Second):\n    return errors.New(\"timeout\")\n}",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.95,
      "how": "select {\ncase v := <-ch:\n    return v, nil\ncase <-ctx.Done():\n    return nil, ctx.Err()\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.89,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-09-12",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}