{
  "id": "go/goroutine-select-on-closed-channel",
  "signature": "panic: receive from closed channel (in select)",
  "signature_zh": "恐慌：从已关闭的通道接收（在select中）",
  "regex": "panic:\\ receive\\ from\\ closed\\ channel\\ \\(in\\ select\\)",
  "domain": "go",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "Selecting on a closed channel immediately receives zero values, which may cause unexpected behavior if not handled.",
  "root_cause_type": "generic",
  "root_cause_zh": "在已关闭的通道上select会立即接收零值，如果不处理可能导致意外行为。",
  "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": "Ignoring closed channel in select",
      "why_fails": "Closed channel always returns zero value immediately; select may not behave as expected.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "Using recover() to catch zero value",
      "why_fails": "Receive from closed channel doesn't panic; it returns zero value with ok=false.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Use two-value receive to check if channel is closed",
      "success_rate": 0.95,
      "how": "select {\ncase val, ok := <-ch:\n    if !ok {\n        // channel closed\n    }\n    // process val\n}",
      "condition": "",
      "sources": []
    },
    {
      "action": "Set channel to nil after close to disable it",
      "success_rate": 0.85,
      "how": "close(ch)\nch = nil\nselect {\ncase <-ch: // blocked because 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.85,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2025-06-30",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}