# TypeError: a coroutine was expected, got <class 'str'>

- **ID:** `python/asyncio-sync-primitive-type-error`
- **Domain:** python
- **Category:** type_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

A non-coroutine object (e.g., a string) is passed to asyncio functions like asyncio.wait() or asyncio.gather() that expect coroutines.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.8 | active | — | — |
| 3.9 | active | — | — |

## Workarounds

1. **Ensure the function is defined as async and called correctly** (95% success)
   ```
   async def my_coro():
    return 'result'
await asyncio.gather(my_coro())
   ```
2. **Use asyncio.iscoroutine() to check before passing** (90% success)
   ```
   if asyncio.iscoroutine(obj):
    await asyncio.gather(obj)
else:
    # handle non-coroutine
   ```

## Dead Ends

- **Wrapping the object in a list** — The function still expects coroutines, not a list of strings. (70% fail)
- **Using asyncio.ensure_future() on the object** — ensure_future() expects a coroutine or future, not a string. (60% fail)
