Skip to content

AxonOps — AI-Native Control Plane for Open Source Data Platforms

Kafka Common Errors

The exception name is only the starting point. Always retain the complete message, cause chain, client ID, broker or coordinator ID, topic-partition, correlation ID, and timestamp.

Kafka protocol errors and client-side exceptions are related but not identical. A Java exception that extends RetriableException is eligible for automatic retry, subject to the operation’s timeout and client state. Retriable does not mean harmless or guaranteed to succeed.

Class of failureTypical response
Transient leader, coordinator, or network changeLet the client refresh metadata and retry within its configured budget
Authorization, authentication, or invalid configurationCorrect identity, ACLs, or configuration; repeated retries add load
Producer or member fencingClose the stale instance and establish ownership; do not loop on the fenced client
Unknown write outcomeUse idempotence or transactions and application-level deduplication; do not assume the write failed
Corruption or storage failureIsolate the affected replica or directory and preserve evidence

Consult the wire-protocol error reference for the complete released error-code table. This page focuses on operational interpretation.

TimeoutException is a boundary, not a root cause. Read the complete message.

Message or contextCommon causeNext check
Timed out waiting for a node assignmentNo usable broker connectionDNS, TLS/SASL, advertised listeners
Topic not present in metadataMissing topic, no leader, ACL denial, or metadata cannot refreshTopic state, broker logs, ACLs
Failed to allocate memory within max.block.msProducer buffer exhausted or metadata unavailablebuffer wait metrics, send rate, broker reachability
Expiring records after delivery.timeout.msProduce requests did not complete inside the delivery budgetrequest latency, retries, ISR, throttling
Admin operation timed outController, broker, or network did not complete the operationquorum health, request metrics, controller logs

Do not increase all timeouts at once. Identify whether time was spent in DNS, connection setup, metadata discovery, the client buffer, the broker queue, replication, or throttling.

Kafka 4.4 Java clients can resolve bootstrap DNS asynchronously when bootstrap.resolve.timeout.ms is positive. This exception means no bootstrap address resolved before that deadline.

Check DNS from the client network namespace, resolver latency and search domains, A/AAAA reachability, and the literal bootstrap names. This setting does not affect DNS failures for broker names returned later in metadata. Kafka Streams and Kafka Connect keep synchronous bootstrap resolution.

These are normally retried, but repetition indicates a real fault. Check broker restarts, load balancer idle timeouts, TLS re-authentication, connection quotas, packet loss, NAT exhaustion, and broker request-handler saturation.

This error is retriable because metadata can be temporarily stale. Persistent occurrences mean one of the following:

  • the topic or partition does not exist;
  • topic creation has not completed;
  • the client cannot describe the topic because of ACLs;
  • the broker has stale metadata or cannot follow the controller;
  • the application uses the wrong cluster or topic name.
Terminal window
kafka-topics.sh --bootstrap-server kafka:9092 \
--describe --topic orders

NotLeaderOrFollowerException and LeaderNotAvailableException

Section titled “NotLeaderOrFollowerException and LeaderNotAvailableException”

These are expected briefly during leader movement. Persistent errors require checks for offline partitions, broker registration, controller health, and client reachability to the newly advertised leader.

Terminal window
kafka-topics.sh --bootstrap-server kafka:9092 \
--describe --unavailable-partitions

The ISR was smaller than min.insync.replicas before the append. The record was rejected.

Terminal window
kafka-topics.sh --bootstrap-server kafka:9092 \
--describe --topic orders
kafka-topics.sh --bootstrap-server kafka:9092 \
--describe --under-min-isr-partitions

Restore failed or lagging replicas. Lowering min.insync.replicas reduces the durability of acknowledged writes and is an explicit incident tradeoff, not the default repair.

The leader appended the record, but the ISR fell below the required size before the acknowledgement completed. The client does not know whether the write became visible. Idempotent producers can retry without creating a duplicate within the producer session. Non-idempotent applications need a business-level deduplication strategy.

RecordTooLargeException and RecordBatchTooLargeException

Section titled “RecordTooLargeException and RecordBatchTooLargeException”

Validate every size boundary in the path:

  • producer max.request.size;
  • topic max.message.bytes or broker message.max.bytes;
  • follower replica.fetch.max.bytes;
  • consumer max.partition.fetch.bytes and fetch.max.bytes;
  • intermediary limits in proxies, Connect, or schema tooling.

Compression does not make an oversized uncompressed record safe at every stage. Prefer a payload reference or chunking design for genuinely large objects.

Producer serialization failed before a valid record was sent. Capture the serializer class, schema ID or version, record type, and cause. Do not log confidential payloads merely to diagnose the failure.

Another producer initialized with the same transactional.id, or the current instance otherwise lost ownership. This is fatal for that producer instance. Close it; do not continue sending or committing.

Use a stable but unique transactional ID per logical producer instance. During failover, fencing the old owner is expected and protects exactly-once semantics.

InvalidProducerEpochException and OutOfOrderSequenceException

Section titled “InvalidProducerEpochException and OutOfOrderSequenceException”

These indicate stale producer state or a broken ordering/session assumption. Modern idempotent producers normally recover internally where safe. If the exception reaches the application as fatal, close and recreate the producer, then investigate duplicate instances, unsupported custom retry logic, broker/client compatibility, and transaction recovery.

Authorization exceptions are fatal for the affected operation and are not solved by retries. Map the operation to its resource:

OperationCommon required resources
ProduceTopic WRITE and usually DESCRIBE
Idempotent produceCluster IDEMPOTENT_WRITE where required by the authorization model
Transactional produceTransactional ID WRITE and topic permissions
Create or alter topicsCluster/topic create or alter permissions

The requested offset is earlier than the log start offset or later than the log end offset. Common causes are retention, topic recreation, offset restore errors, or an application seeking to a bad value.

Choose intentionally between replay and skipping. Stop the group, preview the reset, and retain the plan:

Terminal window
kafka-consumer-groups.sh --bootstrap-server kafka:9092 \
--group orders-consumer \
--topic orders \
--reset-offsets --to-earliest --dry-run

auto.offset.reset is used when no valid initial position exists; changing it does not rewrite an already valid committed offset.

No committed offset exists and auto.offset.reset=none. Either establish an offset through an approved reset or choose earliest/latest for the application’s first-start policy. Confirm that this is not a new group ID caused by a deployment typo.

The consumer no longer owns the partitions under the generation or member epoch used for the commit. Check:

  • processing exceeded max.poll.interval.ms;
  • the process paused, crashed, or lost network connectivity;
  • static members reuse the same group.instance.id;
  • coordinator or broker instability caused repeated rejoins;
  • application code commits from the wrong thread or after partition revocation.

For consume-transform-produce transactions, abort the transaction, poll to obtain current group metadata, and retry the processing loop. Kafka 4.4’s transactional offset-commit protocol can surface more precise group errors; do not collapse them into a blind commit retry.

The group is changing membership or assignment. A short occurrence is normal. Repetition indicates member churn, long poll gaps, slow rebalance callbacks, coordinator instability, incompatible assignors, or frequent deployments.

FencedInstanceIdException and UnreleasedInstanceIdException

Section titled “FencedInstanceIdException and UnreleasedInstanceIdException”

The static instance ID is owned by another live or not-yet-released member. Ensure each simultaneously running instance has a unique group.instance.id. During replacement, let the prior member leave or expire before reusing the ID.

The broker-side consumer protocol rejected a stale member epoch. The member must abandon its assignment and rejoin. Repeated fencing suggests stale concurrent instances, connection churn, coordinator movement, or faulty client lifecycle handling.

RecordDeserializationException identifies the topic-partition and offset that failed. Apache Kafka clients do not provide a universal poison-pill handler. Application or framework code must choose among:

  • stopping and fixing the schema or deserializer;
  • recording the raw bytes and metadata to an application-managed DLQ;
  • seeking past the record with explicit audit and data-loss handling;
  • routing through a framework-specific error handler.

Do not present framework classes as built-in Kafka APIs. Preserve key/value bytes carefully because they may contain sensitive data.

The broker no longer has the client’s share-fetch session. The client normally creates a new session. If it repeats, check connection churn, coordinator movement, client lifecycle, and broker session limits.

The client and broker disagree on the share-session epoch. Re-establish the session. Persistent errors suggest stale concurrent requests, a client compatibility problem, or unstable connections.

The broker reached its share-session limit. Check abandoned sessions, client churn, group concurrency, broker capacity, and the relevant session-limit configuration before raising the limit.

The share coordinator rejected a stale state epoch. Refresh group state and retry only through the supported client flow. Investigate repeated coordinator changes or stale administrative operations.

An acknowledgement error can cause release or redelivery depending on client and broker state. Capture the acknowledgement type, delivery attempt, acquisition-lock timing, and partition. For Kafka 4.4 broker-managed DLQs, verify share.version=2, group DLQ settings, topic existence/configuration, broker authorization, and DLQ write metrics.

Check the mechanism on both ends, principal and password/keytab, JAAS context, SCRAM credential location, Kerberos clock/DNS, OAuth token claims, and listener-specific SASL settings. Repeated authentication retries can trigger connection quotas or lockouts.

The TLS handshake or certificate validation failed. Inspect the nested SSL exception for unknown CA, hostname mismatch, expiry, protocol mismatch, missing client certificate, or algorithm constraints.

TopicAuthorizationException, GroupAuthorizationException, and TransactionalIdAuthorizationException

Section titled “TopicAuthorizationException, GroupAuthorizationException, and TransactionalIdAuthorizationException”

The authenticated principal lacks an operation on the named resource. List ACLs using an authorized administrative identity and consider resource patterns and host restrictions. Do not grant broad wildcard ACLs merely to prove that authorization is the cause; reproduce with the minimum intended permissions.

The process is attempting to join a different cluster from the one recorded locally or returned by the controller. Confirm the intended cluster, configuration, and meta.properties. Do not edit the cluster ID or reformat a directory until you have established whether it contains required data.

The node.id is already registered to another active broker incarnation. Check for a duplicate deployment, cloned volume, stale process, or reused identity. Each concurrently running broker and controller requires a unique node ID.

These commonly follow partial disk replacement, copied data directories, or incorrect storage formatting. Run:

Terminal window
kafka-storage.sh info -c config/broker.properties

Compare every configured log directory. Preserve healthy directories and metadata. Follow the broker or directory replacement procedure rather than manually inventing IDs.

This is normally a connectivity, voter-majority, metadata-storage, or long-pause problem rather than a topic problem.

Terminal window
kafka-metadata-quorum.sh \
--bootstrap-controller controller1:9093 \
describe --status
kafka-metadata-quorum.sh \
--bootstrap-controller controller1:9093 \
describe --replication

Restore a majority. Do not delete the metadata log or format controllers as an exploratory action.

KafkaStorageException and LogDirFailureException

Section titled “KafkaStorageException and LogDirFailureException”

Check kernel logs, disk and inode capacity, mount state, permissions, filesystem health, device latency, and Kafka’s log-directory status. Preserve the exception and affected directory ID.

Terminal window
kafka-log-dirs.sh --bootstrap-server kafka:9092 --describe
df -h
df -i
journalctl -k --since "30 minutes ago"

Do not run fsck on a mounted filesystem, delete Kafka files while the broker is running, or copy arbitrary segments into another live replica.

The error can describe a bad CRC, invalid size, null key in a compacted topic, or other invalid record structure. Determine whether the corruption exists on disk, in transit, or in producer output. Compare replicas, preserve the segment, and inspect a copy with kafka-dump-log.sh. Avoid printing payloads unless access controls permit it.

For Kafka Connect, a FAILED task status includes a trace that is often more useful than the top-level worker log. Capture it before restarting:

Terminal window
curl -sS http://connect.example.com:8083/connectors/orders-sink/status

Separate converter/schema errors, plugin-loading failures, source/sink failures, authorization, and internal-topic health.

For Kafka Streams, distinguish fatal client errors, replace-thread responses, task migration, state restore, RocksDB/storage faults, and transaction fencing. Capture the application ID, task ID, state directory, changelog partition, thread state, and configured uncaught-exception response.

For any recurring error, record:

  • exact first and last occurrence in UTC;
  • frequency and whether retries eventually succeed;
  • client and server versions;
  • client ID, principal, broker/coordinator ID, topic-partition, group, and transactional ID where applicable;
  • the complete exception chain;
  • related metrics, broker/controller logs, and recent changes;
  • whether the operation has an unknown outcome;
  • every mitigation already applied.