# org.apache.kafka.common.errors.FetchSessionIdNotFoundException: Fetch session 123456789 not found

- **ID:** `kafka/fetch-session-id-not-found`
- **Domain:** kafka
- **Category:** protocol_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Consumer fetch session expired or was evicted on broker due to inactivity or broker restart, causing fetch request with stale session ID.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 2.4.0 | active | — | — |
| 3.0.0 | active | — | — |
| 3.3.0 | active | — | — |

## Workarounds

1. **Increase broker's max.incremental.fetch.session.cache.slots to a higher value (e.g., 2000) to prevent session eviction under high load.** (85% success)
   ```
   Increase broker's max.incremental.fetch.session.cache.slots to a higher value (e.g., 2000) to prevent session eviction under high load.
   ```
2. **Reduce consumer fetch request frequency by increasing fetch.min.bytes and fetch.max.wait.ms to reduce session churn.** (80% success)
   ```
   Reduce consumer fetch request frequency by increasing fetch.min.bytes and fetch.max.wait.ms to reduce session churn.
   ```
3. **Upgrade to Kafka 3.4+ where fetch session handling is more robust with improved eviction logic.** (90% success)
   ```
   Upgrade to Kafka 3.4+ where fetch session handling is more robust with improved eviction logic.
   ```

## Dead Ends

- **** — Longer wait does not prevent session eviction; broker still evicts after max.incremental.fetch.session.cache.slots. (80% fail)
- **** — Disabling fetch session requirement is not a valid config; causes broker startup failure. (95% fail)
- **** — Restart creates new session temporarily but error reoccurs if broker evicts again; not a fix. (70% fail)
