# asyncpg.exceptions.InterfaceError: cannot perform operation: another operation is in progress

- **ID:** `python/asyncpg-cannot-perform-operation-another-operation-in-progress`
- **Domain:** python
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Two coroutines used the same asyncpg connection concurrently. asyncpg connections are not concurrency-safe; each must be used by one coroutine at a time.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.8+ | active | — | — |
| 3.9+ | active | — | — |
| 3.10+ | active | — | — |
| 3.11+ | active | — | — |

## Workarounds

1. **** (95% success)
   ```
   pool = await asyncpg.create_pool(dsn, min_size=1, max_size=10)
async with pool.acquire() as conn:
    await conn.fetch('SELECT 1')
   ```
2. **** (90% success)
   ```
   lock = asyncio.Lock()
async with lock:
    await conn.fetch(query)
   ```

## Dead Ends

- **** — Does not serialize access; race still occurs under load. (80% fail)
- **** — Retries can still collide with the same concurrent coroutine and corrupt protocol state. (75% fail)
