{
  "id": "python/starlette-request-body-parse-error",
  "signature": "json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)",
  "signature_zh": "JSON 解码错误：期望值：第 1 行第 1 列（字符 0）",
  "regex": "json\\.decoder\\.JSONDecodeError:\\ Expecting\\ value:\\ line\\ 1\\ column\\ 1\\ \\(char\\ 0\\)",
  "domain": "python",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "Starlette 收到的请求体不是有效的 JSON 格式",
  "root_cause_type": "generic",
  "root_cause_zh": "Starlette 收到的请求体不是有效的 JSON 格式",
  "versions": [
    {
      "version": "3.10",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.11",
      "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": "使用 eval 解析请求体",
      "why_fails": "存在严重安全风险",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "验证请求体格式并返回错误",
      "success_rate": 0.95,
      "how": "try:\n    data = await request.json()\nexcept JSONDecodeError:\n    return JSONResponse({'error': '无效的 JSON'}, status_code=400)",
      "condition": "",
      "sources": []
    },
    {
      "action": "使用 Pydantic 模型自动验证",
      "success_rate": 0.9,
      "how": "from pydantic import BaseModel\nclass Item(BaseModel):\n    name: str\nitem = Item.parse_raw(await request.body())",
      "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": "2025-06-15",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}