Skip to content
Kafka Is Fun
ProducerProducers

TimeoutException: Expiring 5 record(s) for orders-0:120000 ms has passed since batch creation

Checked against Kafka 4.2 · Oct 2026Community draft, not yet reviewed by a Kafka specialist

What it means

The producer accepted the records, but the batch was not delivered within delivery.timeout.ms (120000 ms, two minutes, by default). The client then failed every record in the batch with a TimeoutException. The number in the message is how many records were in the batch, and the time is how long ago the batch was created.

Quick answer

Check that the leader of the partition named in the message is up and reachable from the producer, and look at how fast the broker is accepting data. Also make sure your send callback or future handles the failure, because otherwise nothing else tells you these records were not delivered.

Likely causes, most common first

  1. The partition leader is down, being elected or unreachable

    How to confirm

    Describe the topic and look at the partition named in the message. A missing leader, or an ISR that has shrunk, points here. The unavailable-partitions option lists the partitions whose leader is not available.

    confirm
    kafka-topics.sh --bootstrap-server localhost:9092 --describe --topic orders
    kafka-topics.sh --bootstrap-server localhost:9092 --describe --unavailable-partitions

    Fix

    Bring the broker back or fix the network path to it. If the producer cannot reach the address the broker advertises, see the node -1 entry.

  2. The producer is sending faster than the broker accepts

    How to confirm

    Batches wait inside the producer while the broker is slow. The producer metrics show it: a high request-latency-avg, a high record-queue-time-avg (time spent in the send buffer), and buffer-available-bytes close to zero. On the broker, RequestHandlerAvgIdlePercent and NetworkProcessorAvgIdlePercent are normally between 0 and 1, ideally above 0.3, so values near zero mean it is saturated.

    Fix

    Reduce the send rate, or add partitions and brokers. Larger batches (batch.size, linger.ms, which defaults to 5 since Kafka 4.0) and compression.type (none, gzip, snappy, lz4 or zstd) reduce the number of requests and bytes sent. Raising delivery.timeout.ms on its own only postpones the failure until buffer.memory is full.

  3. delivery.timeout.ms is too small for your own settings

    How to confirm

    The documentation says delivery.timeout.ms should be greater than or equal to the sum of request.timeout.ms and linger.ms. If you lowered it to fail faster, a single slow request can already use it up.

    Fix

    Leave delivery.timeout.ms at its default of 120000 unless you have a reason. If you need to fail faster, choose the value deliberately and handle the failures in the send callback.

See it happen

Break a broker, watch the failover

Opens the simulator with this exercise already running. About 6 minutes.

Reproduce in the simulator

Sources

Every claim above comes from these Apache pages, as of Kafka 4.2. If a page does not say it, this entry does not.

Back to all errors