{
  "id": "go/receive-from-closed-channel-zero-value",
  "signature": "error: unexpected zero value received (channel closed, ok=false ignored)",
  "signature_zh": "错误：收到意外的零值（channel 已关闭，忽略了 ok=false）",
  "regex": "error:\\ unexpected\\ zero\\ value\\ received\\ \\(channel\\ closed,\\ ok=false\\ ignored\\)",
  "domain": "go",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "Reading from a closed channel returns the zero value immediately forever. Code that ignores the 'ok' bool treats zero values as real data, causing silent corruption.",
  "root_cause_type": "generic",
  "root_cause_zh": "从已关闭的 channel 读取会永远立即返回零值。忽略 'ok' 布尔值的代码把零值当作真实数据，造成静默的数据损坏。",
  "versions": [
    {
      "version": "1.18",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.21",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Closed channel always returns immediately; sleep just delays the wrong value",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "len is a snapshot and racy; does not distinguish closed from empty",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "Use the comma-ok idiom: 'v, ok := <-ch; if !ok { return }' and break the loop on close",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.93,
      "how": "Use 'for v := range ch { ... }' which terminates automatically when the channel closes",
      "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-04-08",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}