{
  "id": "python/fastapi-websocket-validation-error",
  "signature": "fastapi.exceptions.WebSocketRequestValidationError: 400 Bad WebSocket Request",
  "signature_zh": "fastapi.exceptions.WebSocketRequestValidationError: 400 错误的 WebSocket 请求",
  "regex": "fastapi\\.exceptions\\.WebSocketRequestValidationError:\\ 400\\ Bad\\ WebSocket\\ Request",
  "domain": "python",
  "category": "network_error",
  "subcategory": null,
  "root_cause": "The WebSocket connection request has invalid parameters or headers.",
  "root_cause_type": "generic",
  "root_cause_zh": "WebSocket 连接请求具有无效的参数或头部。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "This can lead to security vulnerabilities or broken connections.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "This breaks the WebSocket functionality entirely.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Ensure the WebSocket URL includes the correct subprotocols and headers: websocket.connect(\"ws://...\", subprotocols=[\"chat\"])",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "Handle the validation error in the endpoint: except WebSocketRequestValidationError as e: await websocket.close(code=1002)",
      "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.8,
  "fix_success_rate": 0.8,
  "resolvable": "partial",
  "first_seen": "2025-04-02",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}