{
  "id": "go/http-client-request-timeout-context-deadline",
  "signature": "error: Get \"https://example.com\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)",
  "signature_zh": "错误：GET \"https://example.com\"：上下文截止时间已过（客户端超时等待响应头）",
  "regex": "error:\\ Get\\ \"https://example\\.com\":\\ context\\ deadline\\ exceeded\\ \\(Client\\.Timeout\\ exceeded\\ while\\ awaiting\\ headers\\)",
  "domain": "go",
  "category": "network_error",
  "subcategory": null,
  "root_cause": "HTTP客户端请求设置了超时，但服务器响应时间超过该超时，导致请求被取消。",
  "root_cause_type": "generic",
  "root_cause_zh": "HTTP客户端配置了超时限制，但服务器响应时间超过该限制，导致请求被取消。",
  "versions": [
    {
      "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"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "临时增加超时可能掩盖服务器性能问题，且在高负载下仍会失败。",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "如果客户端超时设置错误，复用无效，且可能引入并发安全问题。",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\ndefer cancel()\nreq, _ := http.NewRequestWithContext(ctx, \"GET\", url, nil)\nresp, err := http.DefaultClient.Do(req)",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "使用http.Client{Timeout: 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.88,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-01-10",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}