{
  "id": "go/panic-runtime-error-invalid-memory-address-nil-pointer-in-goroutine",
  "signature": "panic: runtime error: invalid memory address or nil pointer dereference (in goroutine)",
  "signature_zh": "panic：运行时错误：无效内存地址或 nil 指针解引用（在 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 dereferences a nil pointer; because it runs in a background goroutine, the panic crashes the whole program.",
  "root_cause_type": "generic",
  "root_cause_zh": "某个 goroutine 解引用 nil 指针；由于运行在后台 goroutine 中，panic 会导致整个程序崩溃。",
  "versions": [
    {
      "version": "1.0+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Panic happens in a child goroutine; recover in main never sees it.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Any unhandled panic in a goroutine terminates the process.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "go func() {\n    defer func() {\n        if r := recover(); r != nil {\n            log.Printf(\"panic: %v\", r)\n        }\n    }()\n    doWork()\n}()",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.93,
      "how": "if p == nil {\n    return fmt.Errorf(\"nil receiver\")\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.9,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-09-05",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}