# AMQPConnectionError: connection forced (320) CONNECTION_FORCED

- **ID:** `communication/amqp-connection-forced`
- **Domain:** communication
- **Category:** connection_error
- **Error Code:** `320`
- **Verification:** ai_generated
- **Fix Rate:** 83%

## Root Cause

The AMQP broker (e.g., RabbitMQ) forcibly closed the connection due to a resource alarm (memory or disk) or an internal error, often signaled by the connection.blocked method.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| RabbitMQ 3.11 | active | — | — |
| RabbitMQ 3.12 | active | — | — |
| RabbitMQ 3.13 | active | — | — |

## Workarounds

1. **Check broker resource alarms via `rabbitmq-diagnostics check_alarms` and free up memory/disk. For memory: reduce queue sizes or set `vm_memory_high_watermark` lower. For disk: increase `disk_free_limit`.** (83% success)
   ```
   Check broker resource alarms via `rabbitmq-diagnostics check_alarms` and free up memory/disk. For memory: reduce queue sizes or set `vm_memory_high_watermark` lower. For disk: increase `disk_free_limit`.
   ```
2. **Implement connection recovery with backoff and listen to `connection.blocked` event. In Pika (Python): `connection.add_on_connection_blocked_callback(lambda c: time.sleep(10))`.** (78% success)
   ```
   Implement connection recovery with backoff and listen to `connection.blocked` event. In Pika (Python): `connection.add_on_connection_blocked_callback(lambda c: time.sleep(10))`.
   ```

## Dead Ends

- **** — Restarting the client without checking broker resources leads to immediate reconnection and re-disconnection. (80% fail)
- **** — Increasing connection timeout doesn't address the underlying resource exhaustion. (90% fail)
- **** — Adding more consumer instances worsens resource pressure by creating more connections. (70% fail)
