{
  "id": "go/select-no-case-ready-block",
  "signature": "goroutine blocked in select with no ready case (deadlock or long stall)",
  "signature_zh": "goroutine 阻塞在 select 上，没有就绪的 case（死锁或长时间停滞）",
  "regex": "goroutine\\ blocked\\ in\\ select\\ with\\ no\\ ready\\ case\\ \\(deadlock\\ or\\ long\\ stall\\)",
  "domain": "go",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "A select statement with no default blocks until one of its cases can proceed. If none of the channels ever become ready, the goroutine stalls indefinitely.",
  "root_cause_type": "generic",
  "root_cause_zh": "没有 default 的 select 语句会阻塞直到某个 case 可以执行。如果所有 channel 永远不会就绪，goroutine 将无限期停滞。",
  "versions": [
    {
      "version": "1.0+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "A default with a loop spins the CPU at 100% and does not make any channel ready.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "If the channels are never written to, more cases do not help; the goroutine still blocks.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "select {\ncase v := <-ch:\n\tuse(v)\ncase <-time.After(5 * time.Second):\n\treturn errors.New(\"timeout waiting for value\")\n}",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "select {\ncase v := <-ch:\n\tuse(v)\ncase <-ctx.Done():\n\treturn 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.85,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-12-09",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}