{
  "id": "python/uvicorn-h11-local-protocol-error",
  "signature": "h11._util.LocalProtocolError: Illegal header value b'\\n'",
  "signature_zh": "h11._util.LocalProtocolError: 非法的头部值 b'\\n'",
  "regex": "h11\\._util\\.LocalProtocolError:\\ Illegal\\ header\\ value\\ b'\\\\n'",
  "domain": "python",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "Response header contains a newline or invalid character, often from user input echoed into a header via Response(headers=...).",
  "root_cause_type": "generic",
  "root_cause_zh": "响应头包含换行符或非法字符，通常来自用户输入被原样放入 Response(headers=...)。",
  "versions": [
    {
      "version": "0.100+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "0.110+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Embedded \\n still present.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Same ASGI protocol violation under the hood.",
      "fail_rate": 0.75,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.92,
      "how": "value = value.replace('\\r', '').replace('\\n', '')  # sanitize before setting header",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.88,
      "how": "Use JSONResponse(body=...) for untrusted data instead of headers.",
      "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-10-22",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}