{
  "id": "go/channel-send-to-nil-channel",
  "signature": "fatal error: all goroutines are asleep - deadlock! (nil channel send)",
  "signature_zh": "fatal error: 所有 goroutine 都处于休眠状态 - 死锁！（nil channel 发送）",
  "regex": "fatal\\ error:\\ all\\ goroutines\\ are\\ asleep\\ \\-\\ deadlock!\\ \\(nil\\ channel\\ send\\)",
  "domain": "go",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "A goroutine attempted to send to a nil channel, which blocks forever. If no other goroutine can proceed, the runtime detects a deadlock.",
  "root_cause_type": "generic",
  "root_cause_zh": "某个 goroutine 尝试向 nil 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 nil channel in a select will never be ready, so the default case will always be taken, silently dropping the send.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Checking for nil is not atomic and does not guarantee the channel is initialized; it may still be nil at send time.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.98,
      "how": "ch := make(chan int)\n// or ch := make(chan int, 1)",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "select {\ncase ch <- v:\ncase <-time.After(1 * time.Second):\n    return errors.New(\"timeout: channel may be nil\")\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.87,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-09-10",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}