/codes/kafka/kafka-error-codes
Kafka error codes: UNKNOWN_TOPIC_OR_PARTITION, NOT_LEADER and more
The commands on this page have not been executed by our verification runner yet.updated 2026-10-20
- tool
- Apache Kafka
- versions
- Apache Kafka 3.x – 4.x
- os
- any
Kafka brokers answer every failed request with a numeric error code, and clients turn it into an exception such as UnknownTopicOrPartitionException. Code 0 means no error and -1 an unexpected server error. Many codes are retriable (the client retries automatically, for example during a leader election); others need a configuration or permission fix.
Common codes
Codes and messages from the Errors enum in the Apache Kafka source:
| Code | Name | Meaning |
|---|---|---|
| -1 | UNKNOWN_SERVER_ERROR | The server experienced an unexpected error when processing the request. |
| 0 | NONE | No error. |
| 1 | OFFSET_OUT_OF_RANGE | The requested offset is not within the range of offsets maintained by the server. |
| 2 | CORRUPT_MESSAGE | CRC check failed, invalid size, null key on a compacted topic, or otherwise corrupt. |
| 3 | UNKNOWN_TOPIC_OR_PARTITION | This server does not host this topic-partition. |
| 5 | LEADER_NOT_AVAILABLE | There is no leader for this topic-partition as a leadership election is in progress. |
| 6 | NOT_LEADER_OR_FOLLOWER | The broker is not the current leader for a leader-only request. |
| 7 | REQUEST_TIMED_OUT | The request timed out. |
| 10 | MESSAGE_TOO_LARGE | The message is larger than the maximum size the server accepts. |
| 13 | NETWORK_EXCEPTION | The server disconnected before a response was received. |
| 15 | COORDINATOR_NOT_AVAILABLE | The coordinator is not available. |
| 16 | NOT_COORDINATOR | This is not the correct coordinator. |
| 19 | NOT_ENOUGH_REPLICAS | Rejected: fewer in-sync replicas than required. |
| 22 | ILLEGAL_GENERATION | Specified group generation id is not valid. |
| 25 | UNKNOWN_MEMBER_ID | The coordinator is not aware of this member. |
| 27 | REBALANCE_IN_PROGRESS | The group is rebalancing, so a rejoin is needed. |
| 29 | TOPIC_AUTHORIZATION_FAILED | Topic authorization failed. |
| 30 | GROUP_AUTHORIZATION_FAILED | Group authorization failed. |
| 35 | UNSUPPORTED_VERSION | The version of API is not supported. |
| 36 | TOPIC_ALREADY_EXISTS | Topic with this name already exists. |
| 38 | INVALID_REPLICATION_FACTOR | Replication factor is below 1 or larger than the number of available brokers. |
| 58 | SASL_AUTHENTICATION_FAILED | SASL authentication failed. |
| 89 | THROTTLING_QUOTA_EXCEEDED | The throttling quota has been exceeded. |
| 100 | UNKNOWN_TOPIC_ID | This server does not host this topic ID. |
What to do
- 3 UNKNOWN_TOPIC_OR_PARTITION: the topic does not exist (and auto-creation is off) or metadata is stale. Create the topic or check its name.
- 5 / 6 leader errors: transient during broker restarts and elections; producers retry. Persistent errors mean a broker is down.
- 10 MESSAGE_TOO_LARGE: raise
max.request.size(producer) together withmessage.max.bytes(broker) or the topic'smax.message.bytes, or compress and split messages. - 19 NOT_ENOUGH_REPLICAS: fewer in-sync replicas than
min.insync.replicaswhile the producer usesacks=all; bring brokers back or lower the setting. - 27 REBALANCE_IN_PROGRESS / 25 UNKNOWN_MEMBER_ID: consumers took longer than
max.poll.interval.msbetween polls; process faster or raise the interval.
Sources
Related pages
glossary · airflowWhat is a DAG in Apache Airflow?A DAG, or directed acyclic graph, is how Airflow defines a workflow: tasks as nodes, dependencies as edges with no cycles, and a schedule that creates runs.cheat sheets · pandaspandas cheat sheet: read, select, filter, group and reshapepandas cheat sheet: read CSV and Parquet, select with loc and iloc, filter rows, add columns, group and aggregate, pivot, handle missing values and write files.errors · pytorchtorch.OutOfMemoryError: CUDA out of memory. Tried to allocate …PyTorch raises CUDA out of memory when the GPU cannot fit the next allocation. Lower the batch size, use mixed precision, drop references, reduce fragmentation.