{
  "id": "go/select-blocked-forever-no-default",
  "signature": "fatal error: all goroutines are asleep - deadlock! (select with no ready case)",
  "signature_zh": "fatal error: 所有 goroutine 都休眠 - 死锁!（select 无就绪分支）",
  "regex": "fatal\\ error:\\ all\\ goroutines\\ are\\ asleep\\ \\-\\ deadlock!\\ \\(select\\ with\\ no\\ ready\\ case\\)",
  "domain": "go",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "A select with multiple channel cases blocks forever because no case is ever ready and there is no default or timeout. Often a producer/consumer wiring mistake where the expected channel is never written.",
  "root_cause_type": "generic",
  "root_cause_zh": "含多个 channel 分支的 select 因没有任何分支就绪、且无 default 或超时，永久阻塞。常为生产者/消费者接线错误，预期的 channel 从未被写入。",
  "versions": [
    {
      "version": "1.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Turns the blocking select into a busy spin that burns CPU and still never handles the missing event.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "If the root wiring is wrong, extra cases don't become ready and the deadlock persists.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Add a context or timeout case to break the block and surface the bug:\nselect {\ncase v := <-ch:\n    use(v)\ncase <-ctx.Done():\n    return ctx.Err()\ncase <-time.After(30 * time.Second):\n    return errors.New(\"select timeout\")\n}",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "Verify the producer actually sends on the expected channel and that the channel is not nil (sending to a nil channel blocks forever).",
      "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.88,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-10-05",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}