{
  "id": "go/http-request-context-canceled",
  "signature": "http: request context canceled",
  "signature_zh": "http: 请求上下文已取消",
  "regex": "http:\\ request\\ context\\ canceled",
  "domain": "go",
  "category": "network_error",
  "subcategory": null,
  "root_cause": "The client canceled the request or the server's context was canceled due to timeout or client disconnect, causing the HTTP handler to abort.",
  "root_cause_type": "generic",
  "root_cause_zh": "客户端取消请求或服务器上下文因超时或客户端断开而取消，导致 HTTP 处理器中止。",
  "versions": [
    {
      "version": "1.17",
      "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"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Processing continues but the client is gone; results are wasted and may cause resource leaks.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Long timeouts can lead to resource exhaustion and don't address client-initiated cancellations.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Check for context cancellation and return early: if r.Context().Err() != nil { return }",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.7,
      "how": "Use http.Server with ReadTimeout and WriteTimeout properly: &http.Server{ReadTimeout: 10*time.Second, WriteTimeout: 10*time.Second}",
      "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.85,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-01-15",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}