{
  "id": "python/starlette-websocket-disconnect-receive",
  "signature": "starlette.websockets.WebSocketDisconnect: 1000",
  "signature_zh": "starlette.websockets.WebSocketDisconnect: 1000",
  "regex": "starlette\\.websockets\\.WebSocketDisconnect:\\ 1000",
  "domain": "python",
  "category": "network_error",
  "subcategory": null,
  "root_cause": "Client closed the WebSocket while the server was awaiting receive_text/receive_json.",
  "root_cause_type": "generic",
  "root_cause_zh": "服务器在等待receive_text/receive_json时客户端关闭了WebSocket。",
  "versions": [
    {
      "version": "0.30.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "0.36.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Socket is closed; next receive raises again immediately.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Does not prevent application-level disconnects.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "try:\\n    msg = await ws.receive_text()\\nexcept WebSocketDisconnect:\\n    return",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.92,
      "how": "try:\\n    while True: ...\\nfinally:\\n    await manager.disconnect(ws)",
      "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.86,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2025-03-05",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}