{
  "id": "nginx/upstream-sent-invalid-chunked-transfer-encoding",
  "signature": "upstream sent invalid chunked transfer encoding while reading response body from upstream",
  "signature_zh": "上游发送了无效的 chunked 传输编码",
  "regex": "upstream sent invalid chunked transfer encoding while reading response body from upstream",
  "domain": "nginx",
  "category": "protocol_error",
  "subcategory": null,
  "root_cause": "Upstream server sent a malformed chunked response (e.g., missing CRLF, invalid chunk size) that violates HTTP/1.1 chunked transfer encoding rules.",
  "root_cause_type": "generic",
  "root_cause_zh": "上游服务器发送了格式错误的 chunked 响应（例如缺少 CRLF、无效的块大小），违反了 HTTP/1.1 的分块传输编码规则。",
  "versions": [
    {
      "version": "nginx/1.24.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "nginx/1.22.1",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "nginx/1.26.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Timeout does not fix malformed data; the error is structural, not timing-related.",
      "fail_rate": 0.75,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "If upstream expects HTTP/1.1, this may break communication; also, nginx still parses chunked if upstream sends it.",
      "fail_rate": 0.65,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "This directive does not exist in nginx; it is a common misconception.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Fix the upstream application to generate proper chunked encoding (e.g., in Go: ensure http.ResponseWriter uses default chunking correctly, avoid manual chunked writes).",
      "success_rate": 0.9,
      "how": "Fix the upstream application to generate proper chunked encoding (e.g., in Go: ensure http.ResponseWriter uses default chunking correctly, avoid manual chunked writes).",
      "condition": "",
      "sources": []
    },
    {
      "action": "Disable chunked transfer encoding in upstream by setting Content-Length header in the response (e.g., in Node.js: res.setHeader('Content-Length', Buffer.byteLength(body)); res.end(body)).",
      "success_rate": 0.85,
      "how": "Disable chunked transfer encoding in upstream by setting Content-Length header in the response (e.g., in Node.js: res.setHeader('Content-Length', Buffer.byteLength(body)); res.end(body)).",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use proxy_set_header Connection ''; to force HTTP/1.0 and avoid chunked encoding, then ensure upstream responds with Content-Length.",
      "success_rate": 0.75,
      "how": "Use proxy_set_header Connection ''; to force HTTP/1.0 and avoid chunked encoding, then ensure upstream responds with Content-Length.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Fix the upstream application to generate proper chunked encoding (e.g., in Go: ensure http.ResponseWriter uses default chunking correctly, avoid manual chunked writes).",
    "Disable chunked transfer encoding in upstream by setting Content-Length header in the response (e.g., in Node.js: res.setHeader('Content-Length', Buffer.byteLength(body)); res.end(body)).",
    "Use proxy_set_header Connection ''; to force HTTP/1.0 and avoid chunked encoding, then ensure upstream responds with Content-Length."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://nginx.org/en/docs/http/ngx_http_upstream_module.html",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.82,
  "fix_success_rate": 0.88,
  "resolvable": "true",
  "first_seen": "2024-06-20",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}