{
  "id": "python/fastapi-await-none-coroutine",
  "signature": "TypeError: object NoneType can't be used in 'await' expression",
  "signature_zh": "TypeError: NoneType 对象不能用于 'await' 表达式",
  "regex": "TypeError:\\ object\\ NoneType\\ can't\\ be\\ used\\ in\\ 'await'\\ expression",
  "domain": "python",
  "category": "type_error",
  "subcategory": null,
  "root_cause": "An async route awaits a call that is actually synchronous (e.g. a sync DB driver or a function returning None).",
  "root_cause_type": "generic",
  "root_cause_zh": "异步路由 await 了一个实际上是同步的调用（例如同步数据库驱动或返回 None 的函数）。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Fixes this call but blocks the event loop for other requests.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Doesn't make the awaited object awaitable.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.88,
      "how": "Use an async driver or run sync in a threadpool:\nfrom starlette.concurrency import run_in_threadpool\nresult = await run_in_threadpool(sync_fn)",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Remove await when calling a synchronous function.",
      "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.85,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-12-15",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}