{
  "id": "go/nil-pointer-dereference-goroutine",
  "signature": "panic: runtime error: invalid memory address or nil pointer dereference (in goroutine)",
  "signature_zh": "panic: 运行时错误：无效的内存地址或空指针解引用（在 goroutine 中）",
  "regex": "panic:\\ runtime\\ error:\\ invalid\\ memory\\ address\\ or\\ nil\\ pointer\\ dereference\\ \\(in\\ goroutine\\)",
  "domain": "go",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "A goroutine attempted to dereference a nil pointer. This often occurs when a shared pointer is set to nil by another goroutine, or when a struct field is not initialized before being used in a goroutine.",
  "root_cause_type": "generic",
  "root_cause_zh": "某个 goroutine 尝试解引用空指针。通常发生在共享指针被另一个 goroutine 设置为 nil，或结构体字段在 goroutine 中使用前未初始化。",
  "versions": [
    {
      "version": "1.0+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "The pointer may become nil between the check and the dereference due to a race condition. Nil checks are not atomic with the dereference.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Recovering prevents the crash but leaves the program in an inconsistent state; the root cause remains.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "var mu sync.Mutex\nmu.Lock()\nif ptr != nil {\n    // use ptr\n}\nmu.Unlock()",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "go func(v MyStruct) {\n    // use v\n}(*ptr)",
      "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-06-18",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}