# org.apache.kafka.common.errors.PartitionNotFoundException: This server does not host this partition

- **ID:** `kafka/partition-not-found`
- **Domain:** kafka
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 78%

## Root Cause

Client request targets a partition that is not hosted on the broker, often due to stale metadata or partition reassignment.

## Workarounds

1. **Force metadata refresh by setting metadata.max.age.ms to a lower value, e.g., props.put("metadata.max.age.ms", "5000");** (75% success)
   ```
   Force metadata refresh by setting metadata.max.age.ms to a lower value, e.g., props.put("metadata.max.age.ms", "5000");
   ```
2. **Wait for partition reassignment to complete and check status: kafka-reassign-partitions.sh --bootstrap-server localhost:9092 --verify --reassignment-json-file reassign.json** (85% success)
   ```
   Wait for partition reassignment to complete and check status: kafka-reassign-partitions.sh --bootstrap-server localhost:9092 --verify --reassignment-json-file reassign.json
   ```
3. **Restart the client to force a fresh metadata fetch from the broker.** (70% success)
   ```
   Restart the client to force a fresh metadata fetch from the broker.
   ```

## Dead Ends

- **** — Manually deleting the partition metadata can lead to data loss and inconsistency. (95% fail)
- **** — Ignoring the error and retrying without refreshing metadata will keep failing. (90% fail)
