{
  "id": "go/goroutine-nil-pointer-nil-channel",
  "signature": "panic: runtime error: invalid memory address or nil pointer dereference",
  "signature_zh": "panic：运行时错误：无效内存地址或空指针解引用",
  "regex": "panic:\\ runtime\\ error:\\ invalid\\ memory\\ address\\ or\\ nil\\ pointer\\ dereference",
  "domain": "go",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "A goroutine dereferenced a nil pointer, often because a struct or channel field was not initialized before the goroutine started, or a nil channel was used in select.",
  "root_cause_type": "generic",
  "root_cause_zh": "某个 goroutine 解引用了空指针，通常是因为在 goroutine 启动前结构体或 channel 字段未初始化，或在 select 中使用了 nil channel。",
  "versions": [
    {
      "version": "1.0+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "The nil dereference indicates a real bug; recovering leaves the program in an inconsistent state and the nil access may recur.",
      "fail_rate": 0.75,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Race conditions and ordering issues mean the pointer may still be nil when accessed; proper initialization must happen before goroutine launch.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "s := &Service{ch: make(chan int, 1)}\ngo s.run()",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "if s == nil || s.ch == nil {\n\treturn\n}\n// safe to use s.ch",
      "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-07-03",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}