{
  "id": "python/fastapi-upload-file-size-error",
  "signature": "starlette.datastructures.UploadFile: 413 Request Entity Too Large",
  "signature_zh": "Starlette数据结构：413请求实体过大",
  "regex": "starlette\\.datastructures\\.UploadFile:\\ 413\\ Request\\ Entity\\ Too\\ Large",
  "domain": "python",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "The uploaded file exceeds the server's maximum allowed size, often due to default limits in the web server or framework.",
  "root_cause_type": "generic",
  "root_cause_zh": "上传的文件超过服务器允许的最大大小，通常是由于Web服务器或框架的默认限制。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Reading the entire file into memory before checking size can cause memory issues.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Increasing the limit globally may affect other parts of the app.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Configure the server limit, e.g., in Uvicorn: uvicorn app:app --limit-max-request-size 10485760",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.95,
      "how": "Check file size before processing: if file.size > MAX_SIZE:\\n    raise HTTPException(413)",
      "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-07-08",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}