{
  "id": "go/goroutine-timer-reset-after-expiry",
  "signature": "panic: time: Reset called on timer that has already fired or been stopped",
  "signature_zh": "恐慌：时间：对已触发或已停止的计时器调用Reset",
  "regex": "panic:\\ time:\\ Reset\\ called\\ on\\ timer\\ that\\ has\\ already\\ fired\\ or\\ been\\ stopped",
  "domain": "go",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "Calling Reset() on a time.Timer that has already expired or been stopped, which is not allowed in Go 1.18+ without proper draining.",
  "root_cause_type": "generic",
  "root_cause_zh": "对已过期或已停止的time.Timer调用Reset()，在Go 1.18+中不允许，除非正确排空通道。",
  "versions": [
    {
      "version": "1.18",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.19",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.20",
      "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"
    },
    {
      "version": "1.22",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Using recover() to ignore panic",
      "why_fails": "Does not fix timer state issue.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "Calling Stop() before Reset() without draining",
      "why_fails": "Stop() returns false if already fired, but Reset still panics if channel not drained.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Drain timer channel before Reset",
      "success_rate": 0.95,
      "how": "if !t.Stop() { <-t.C }; t.Reset(duration)",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use time.NewTimer and avoid Reset",
      "success_rate": 0.9,
      "how": "t := time.NewTimer(duration); // use once and recreate 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.84,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-12-01",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}