conduktor.io ↗

Kafka Fetch Response Wire Format v6 — Binary Protocol Layout

What is Fetch?

Consumers and follower replicas both issue this continuously for log replication and consumption. When a consumer's fetch stalls with empty responses despite records existing, check isolation.level: read_committed consumers are blocked by open transactions until EndTxn.

Related Errors

FENCED_LEADER_EPOCH · FETCH_SESSION_ID_NOT_FOUND · FETCH_SESSION_TOPIC_ID_ERROR · INVALID_FETCH_SESSION_EPOCH · KAFKA_STORAGE_ERROR · LEADER_NOT_AVAILABLE · NETWORK_EXCEPTION · NOT_LEADER_OR_FOLLOWER · OFFSET_MOVED_TO_TIERED_STORAGE · OFFSET_NOT_AVAILABLE · OFFSET_OUT_OF_RANGE · THROTTLING_QUOTA_EXCEEDED · TOPIC_AUTHORIZATION_FAILED · UNKNOWN_LEADER_EPOCH · UNKNOWN_TOPIC_ID · UNKNOWN_TOPIC_OR_PARTITION

Wire Diagram

Response Header
message_size int32 · 4B
correlation_id int32 · 4B
FetchResponse v6
ThrottleTimeMs int32 · 4B
Responses array
Topic string
Partitions array
PartitionIndex int32 · 4B
ErrorCode int16 · 2B
HighWatermark int64 · 8B
LastStableOffset int64 · 8B
LogStartOffset int64 · 8B
AbortedTransactions? array
Records? records
ProducerId int64 · 8B
FirstOffset int64 · 8B

Schema & Example

Schema
{
  "ThrottleTimeMs": int32,
  "Responses": [{
      "Topic": string,
      "Partitions": [{
          "PartitionIndex": int32,
          "ErrorCode": int16,
          "HighWatermark": int64,
          "LastStableOffset": int64,
          "LogStartOffset": int64,
          "AbortedTransactions": [{
              "ProducerId": int64,
              "FirstOffset": int64
          }]?,
          "Records": records?
      }]
  }]
}
Example
{
  "ThrottleTimeMs": 0,
  "Responses": [{
      "Topic": "orders",
      "Partitions": [{
          "PartitionIndex": 3,
          "ErrorCode": 0,
          "HighWatermark": 284729,
          "LastStableOffset": 284729,
          "LogStartOffset": 284729,
          "AbortedTransactions": [{
              "ProducerId": 0,
              "FirstOffset": 150382
          }]?,
          "Records": null
      }]
  }]
}