{
  "id": "python/starlette-request-body-json-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": "The request body is empty or not valid JSON when the endpoint tries to parse it as JSON.",
  "root_cause_type": "generic",
  "root_cause_zh": "请求体为空或不是有效的 JSON，而端点尝试将其解析为 JSON。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Catches the error but doesn't provide a meaningful response; the client still gets a 500.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "body() returns bytes; you still need to decode and parse, same issue if empty.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Validate content-type and body: if request.headers.get('content-type') == 'application/json' and await request.body(): data = await request.json() else: return JSONResponse({'error': 'Invalid JSON'}, status_code=400)",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.95,
      "how": "Use FastAPI's body parameter with Pydantic model to automatically handle validation errors",
      "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": "2024-11-12",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}