{
  "id": "go/once-reuse-panic",
  "signature": "panic: sync: Once is reused",
  "signature_zh": "panic: sync: Once 被重复使用",
  "regex": "panic:\\ sync:\\ Once\\ is\\ reused",
  "domain": "go",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "Attempting to reuse a sync.Once after it has been used, which is not allowed.",
  "root_cause_type": "generic",
  "root_cause_zh": "在 sync.Once 已被使用后再次尝试使用它，这是不允许的。",
  "versions": [
    {
      "version": "1.19",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Copying a sync.Once is unsafe and can cause races; it's not designed to be copied.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "If the Once is embedded in a struct that's reused, it may still be copied.",
      "fail_rate": 0.4,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Use a flag with atomic operations to implement single execution: \n\nvar done int32\ngo func() {\n    if atomic.CompareAndSwapInt32(&done, 0, 1) {\n        // do once\n    }\n}()",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "Ensure Once is used only once per lifecycle, and create a new instance if needed.",
      "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.8,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-01-18",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}