# RuntimeError: 协程对象不可调用

- **ID:** `python/fastapi-runtimeerror-coroutine-object-is-not-callable`
- **领域:** python
- **类别:** runtime_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

尝试将协程作为函数调用而未使用 await，或者将协程赋值给变量后调用。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.x | active | — | — |

## 解决方案

1. **Use await when calling async functions.** (95% 成功率)
   ```
   async def get_data():
    return await fetch_data()
   ```
2. **Run the coroutine in an event loop if outside async context.** (85% 成功率)
   ```
   import asyncio
result = asyncio.run(async_function())
   ```

## 无效尝试

- **Calling an async function without await inside a sync function.** — Sync functions cannot use await; calling an async function returns a coroutine object, not the result. (80% 失败率)
- **Storing a coroutine in a variable and then using () on it.** — The variable holds a coroutine object; calling it again tries to call the coroutine, which is not allowed. (70% 失败率)
