# org.apache.kafka.common.errors.UnknownServerException: The server experienced an unexpected error.

- **ID:** `kafka/unknown-server-exception`
- **Domain:** kafka
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 75%

## Root Cause

An internal broker error occurred, often due to a corrupted message or disk I/O failure that the broker cannot classify.

## Workarounds

1. **Check broker logs for detailed stack trace: `grep -i 'UnknownServerException' /var/log/kafka/server.log`. Then run `fsck` on the data directory or replace the disk if bad sectors are detected.** (70% success)
   ```
   Check broker logs for detailed stack trace: `grep -i 'UnknownServerException' /var/log/kafka/server.log`. Then run `fsck` on the data directory or replace the disk if bad sectors are detected.
   ```
2. **If corruption is isolated to a topic partition, use `kafka-reassign-partitions.sh` to move replicas to a healthy broker and delete the corrupt data directory.** (80% success)
   ```
   If corruption is isolated to a topic partition, use `kafka-reassign-partitions.sh` to move replicas to a healthy broker and delete the corrupt data directory.
   ```

## Dead Ends

- **** — Restarting the broker without checking logs or disk health only delays the error; the underlying corruption persists and will recur. (80% fail)
- **** — Increasing replication factor doesn't fix the corrupt data on the affected broker; it just adds replicas that may also encounter the issue. (90% fail)
