Kafka Error SHARE_SESSION_NOT_FOUND
Error code 122 · Retriable Share Groups
The share session was not found.
Common Causes
- The share session was created on a specific broker but the client's subsequent `ShareFetch` request was routed to a different broker (e.g., after a broker restart or leader change), where the session doesn't exist.
- Share session was evicted from broker memory due to inactivity timeout or broker-side session limit being reached, and the client is still trying to use the evicted session ID.
- Client reconnected after a network interruption with a stale share session ID; the broker had already cleaned up the session during the disconnection period.
Solutions
- The error is retriable — the client should recreate the share session by sending a new `ShareFetch` request with `shareSessionEpoch=0` (epoch 0 signals session creation). Kafka client libraries handle this automatically.
- Ensure the share fetch client connects to the partition leader for the relevant partitions. After a leader change, the session must be re-established on the new leader broker.
- Tune the broker's share session keep-alive settings to avoid premature eviction for consumers with bursty processing patterns. Monitor broker memory if session evictions are frequent.
Diagnostic Commands
# Describe share group state and members
kafka-share-groups.sh --bootstrap-server localhost:9092 --describe --group <share-group-id>
# Look for share session events in logs
grep 'SHARE_SESSION_NOT_FOUND\|ShareFetch\|share session' /var/log/kafka/server.log | tail -50Related APIs
This error can be returned by: ShareAcknowledge · ShareFetch
Debugging Kafka errors? Conduktor Console gives you real-time visibility into your cluster. Explore all errors in the Error Decoder.