# RuntimeWarning: coroutine 'send_email' was never awaited

- **ID:** `python/fastapi-background-task-not-awaited`
- **Domain:** python
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Passing an async function to BackgroundTasks.add_task without awaiting; or calling an async function directly in a sync route without scheduling.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 0.100.x | active | — | — |
| 0.110.x | active | — | — |

## Workarounds

1. **** (95% success)
   ```
   In async route: `background_tasks.add_task(send_email, to, body)` — FastAPI awaits it after response.
   ```
2. **** (85% success)
   ```
   For sync routes, use a sync function or `asyncio.run(send_email(...))` (careful with loops) or offload to Celery.
   ```

## Dead Ends

- **** — Task may be cancelled when request ends; not tracked by FastAPI. (80% fail)
- **** — Requires a running event loop and proper thread context; often raises RuntimeError. (75% fail)
