{
  "id": "go/http-write-after-shutdown",
  "signature": "http: write on closed connection",
  "signature_zh": "http：在已关闭的连接上写入",
  "regex": "http:\\ write\\ on\\ closed\\ connection",
  "domain": "go",
  "category": "network_error",
  "subcategory": null,
  "root_cause": "Attempting to write a response to a client connection that has already been closed, often due to a timeout or client disconnect.",
  "root_cause_type": "generic",
  "root_cause_zh": "尝试向已关闭的客户端连接写入响应，通常是由于超时或客户端断开连接。",
  "versions": [
    {
      "version": "1.21",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "The write will fail silently, and the client will never receive the response.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The issue is not buffer size but connection state.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.85,
      "how": "if err := json.NewEncoder(w).Encode(data); err != nil {\n    log.Printf(\"Error writing response: %v\", err)\n}",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.8,
      "how": "Use context cancellation to detect client disconnects early.",
      "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.87,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-08-02",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}