Kafka Exception TaskCorruptedException
org.apache.kafka.streams.errors.TaskCorruptedException
Non-retriable
Streams
Indicates a specific task is corrupted and need to be re-initialized. It can be thrown when: Under EOS, if the checkpoint file does not contain offsets for corresponding store's changelogs, meaning previously it was not close cleanly. Out-of-range exception thrown during restoration, meaning that the changelog has been modified and we re-bootstrap the store.
Reviewed 2026-10-27 · 4.4.0 · source-reviewed. Source · Source · Source
Common Causes
- Streams detected task state that cannot safely continue, for example after a transactional/restore failure. Inspect the underlying cause; an unclean shutdown alone does not establish corruption.
Solutions
- Let Streams handle task corruption according to the installed version; inspect the original cause and logs. Do not delete changelog topics as a generic repair.
- If the transaction budget is inadequate, review producer.transaction.timeout.ms and the broker transaction.max.timeout.ms together. The producer override is different from a Streams top-level option.
- Kafka 4.4 adds opt-in transactional state stores (enable.transactional.statestores=false by default). Recovery behavior differs with this mode; a blanket promise of a full wipe/rebuild is incorrect.
- Check the release-specific upgrade notes for task-corruption and state-updater fixes, including 4.3.2, before attributing repeated restoration to tuning alone.
Example Stack Trace
org.apache.kafka.streams.errors.TaskCorruptedException: Tasks [0_2] are corrupted and hence need to be re-initialized
at org.apache.kafka.streams.processor.internals.StoreChangelogReader.restore(StoreChangelogReader.java:578)
at org.apache.kafka.streams.processor.internals.TaskManager.tryToCompleteRestoration(TaskManager.java:660)
at org.apache.kafka.streams.processor.internals.StreamThread.initializeAndRestorePhase(StreamThread.java:902)
at org.apache.kafka.streams.processor.internals.StreamThread.runOnce(StreamThread.java:757)
at org.apache.kafka.streams.processor.internals.StreamThread.runLoop(StreamThread.java:617)
Caused by: org.apache.kafka.clients.consumer.OffsetOutOfRangeException: Fetch position FetchPosition{offset=15233} is out of range for partition my-app-store-changelog-2Diagnostic Commands
kafka-get-offsets.sh --bootstrap-server localhost:9092 --topic my-app-store-changelog --time -2 # earliest offset vs the out-of-range position in the trace
kafka-topics.sh --bootstrap-server localhost:9092 --describe --topic my-app-store-changelog # verify cleanup.policy=compact and retention settings
kafka-streams-application-reset.sh --application-id my-app --bootstrap-server localhost:9092 # plus delete local state.dir to force a clean rebuild after corruptionRelated
Related Streams exceptions: BrokerNotFoundException · InternalTopicsAlreadySetupException · InvalidStateStoreException · InvalidStateStorePartitionException · LockException · MisconfiguredInternalTopicException · MissingInternalTopicsException · MissingSourceTopicException
Hitting
TaskCorruptedException in production? Conduktor Console gives you real-time visibility into clients, consumer groups, and broker health. Browse every Kafka exception or protocol error code.