Skip to content

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

Kafka Protocol Error Codes

This document provides a complete reference of all Kafka protocol error codes, including retriability classification, the introduced version, and default error messages.


CategoryDescriptionClient Action
SuccessOperation completedContinue normally
RetriableTemporary failureRetry with backoff
Non-RetriableClient errorFix request and retry
FatalUnrecoverableClose and reinitialize
Receive error codeyesCode == 0?SuccessyesRetriable flag set?noRetries remaining?yesnoApply backoffRetry requestReport failureFatal error?yesnoClose clientReinitializeReport to applicationApplication handles

The Message column is the default error message defined in Kafka source. Client handling decisions should be based on the error code and retriable status; patterns below outline typical handling flows.

CodeNameRetriableIntroducedMessage
0NONEN/A0.8.0null

NONE has no default error message (null).


CodeNameRetriableIntroducedMessage
-1UNKNOWN_SERVER_ERROR0.8.0The server experienced an unexpected error when processing the request.
1OFFSET_OUT_OF_RANGE0.8.0The requested offset is not within the range of offsets maintained by the server.
2CORRUPT_MESSAGE0.8.0This message has failed its CRC checksum, exceeds the valid size, has a null key for a compacted topic, or is otherwise corrupt.

CodeNameRetriableIntroducedMessage
3UNKNOWN_TOPIC_OR_PARTITION0.8.0This server does not host this topic-partition.
4INVALID_FETCH_SIZE0.8.0The requested fetch size is invalid.
5LEADER_NOT_AVAILABLE0.8.0There is no leader for this topic-partition as we are in the middle of a leadership election.
6NOT_LEADER_OR_FOLLOWER0.8.0For requests intended only for the leader, this error indicates that the broker is not the current leader. For requests intended for any replica, this error indicates that the broker is not a replica of the topic partition.

CodeNameRetriableIntroducedMessage
7REQUEST_TIMED_OUT0.8.0The request timed out.
8BROKER_NOT_AVAILABLE0.8.0The broker is not available.
9REPLICA_NOT_AVAILABLE0.8.0The replica is not available for the requested topic-partition. Produce/Fetch requests and other requests intended only for the leader or follower return NOT_LEADER_OR_FOLLOWER if the broker is not a replica of the topic-partition.
10MESSAGE_TOO_LARGE0.8.0The request included a message larger than the max message size the server will accept.
11STALE_CONTROLLER_EPOCH0.8.0The controller moved to another broker.
12OFFSET_METADATA_TOO_LARGE0.8.1The metadata field of the offset request was too large.
13NETWORK_EXCEPTION0.8.1The server disconnected before a response was received.
14COORDINATOR_LOAD_IN_PROGRESS0.9.0.0The coordinator is loading and hence can’t process requests.
15COORDINATOR_NOT_AVAILABLE0.9.0.0The coordinator is not available.

CodeNameRetriableIntroducedMessage
16NOT_COORDINATOR0.9.0.0This is not the correct coordinator.
17INVALID_TOPIC_EXCEPTION0.8.2.0The request attempted to perform an operation on an invalid topic.
18RECORD_LIST_TOO_LARGE0.8.2.0The request included message batch larger than the configured segment size on the server.
19NOT_ENOUGH_REPLICAS0.8.2.0Messages are rejected since there are fewer in-sync replicas than required.

CodeNameRetriableIntroducedMessage
20NOT_ENOUGH_REPLICAS_AFTER_APPEND0.8.2.0Messages are written to the log, but to fewer in-sync replicas than required.
21INVALID_REQUIRED_ACKS0.9.0.0Produce request specified an invalid value for required acks.
22ILLEGAL_GENERATION0.9.0.0Specified group generation id is not valid.
23INCONSISTENT_GROUP_PROTOCOL0.9.0.0The group member’s supported protocols are incompatible with those of existing members or first group member tried to join with empty protocol type or empty protocol list.

CodeNameRetriableIntroducedMessage
24INVALID_GROUP_ID0.9.0.0The group id is invalid.
25UNKNOWN_MEMBER_ID0.9.0.0The coordinator is not aware of this member.
26INVALID_SESSION_TIMEOUT0.9.0.0The session timeout is not within the range allowed by the broker (as configured by group.min.session.timeout.ms and group.max.session.timeout.ms).
27REBALANCE_IN_PROGRESS0.9.0.0The group is rebalancing, so a rejoin is needed.
28INVALID_COMMIT_OFFSET_SIZE0.9.0.0The committing offset data size is not valid.

CodeNameRetriableIntroducedMessage
29TOPIC_AUTHORIZATION_FAILED0.9.0.0Topic authorization failed.
30GROUP_AUTHORIZATION_FAILED0.9.0.0Group authorization failed.
31CLUSTER_AUTHORIZATION_FAILED0.9.0.0Cluster authorization failed.

CodeNameRetriableIntroducedMessage
32INVALID_TIMESTAMP0.10.0.0The timestamp of the message is out of acceptable range.
33UNSUPPORTED_SASL_MECHANISM0.10.0.0The broker does not support the requested SASL mechanism.
34ILLEGAL_SASL_STATE0.10.0.0Request is not valid given the current SASL state.
35UNSUPPORTED_VERSION0.10.0.0The version of API is not supported.
36TOPIC_ALREADY_EXISTS0.10.1.0Topic with this name already exists.
37INVALID_PARTITIONS0.10.1.0Number of partitions is below 1.
38INVALID_REPLICATION_FACTOR0.10.1.0Replication factor is below 1 or larger than the number of available brokers.
39INVALID_REPLICA_ASSIGNMENT0.10.1.0Replica assignment is invalid.
40INVALID_CONFIG0.10.1.0Configuration is invalid.

CodeNameRetriableIntroducedMessage
41NOT_CONTROLLER0.10.1.0This is not the correct controller for this cluster.
42INVALID_REQUEST0.10.1.0This most likely occurs because of a request being malformed by the client library or the message was sent to an incompatible broker. See the broker logs for more details.
43UNSUPPORTED_FOR_MESSAGE_FORMAT0.10.1.0The message format version on the broker does not support the request.
44POLICY_VIOLATION0.10.2.0Request parameters do not satisfy the configured policy.
45OUT_OF_ORDER_SEQUENCE_NUMBER0.11.0.0The broker received an out of order sequence number.
46DUPLICATE_SEQUENCE_NUMBER0.11.0.0The broker received a duplicate sequence number.

CodeNameRetriableIntroducedMessage
47INVALID_PRODUCER_EPOCH0.11.0.0Producer attempted to produce with an old epoch.
48INVALID_TXN_STATE0.11.0.0The producer attempted a transactional operation in an invalid state.
49INVALID_PRODUCER_ID_MAPPING0.11.0.0The producer attempted to use a producer id which is not currently assigned to its transactional id.
50INVALID_TRANSACTION_TIMEOUT0.11.0.0The transaction timeout is larger than the maximum value allowed by the broker (as configured by transaction.max.timeout.ms).
51CONCURRENT_TRANSACTIONS0.11.0.0The producer attempted to update a transaction while another concurrent operation on the same transaction was ongoing.
52TRANSACTION_COORDINATOR_FENCED0.11.0.0Indicates that the transaction coordinator sending a WriteTxnMarker is no longer the current coordinator for a given producer.
53TRANSACTIONAL_ID_AUTHORIZATION_FAILED0.11.0.0Transactional Id authorization failed.
54SECURITY_DISABLED0.11.0.0Security features are disabled.
55OPERATION_NOT_ATTEMPTED0.11.0.0The broker did not attempt to execute this operation. This may happen for batched RPCs where some operations in the batch failed, causing the broker to respond without trying the rest.
56KAFKA_STORAGE_ERROR1.0.0Disk error when trying to access log file on the disk.
57LOG_DIR_NOT_FOUND1.0.0The user-specified log directory is not found in the broker config.

CodeNameRetriableIntroducedMessage
58SASL_AUTHENTICATION_FAILED1.0.0SASL Authentication failed.
59UNKNOWN_PRODUCER_ID1.0.0This exception is raised by the broker if it could not locate the producer metadata associated with the producerId in question. This could happen if, for instance, the producer’s records were deleted because their retention time had elapsed. Once the last records of the producerId are removed, the producer’s metadata is removed from the broker, and future appends by the producer will return this exception.
60REASSIGNMENT_IN_PROGRESS1.0.0A partition reassignment is in progress.
61DELEGATION_TOKEN_AUTH_DISABLED1.1.0Delegation Token feature is not enabled.
62DELEGATION_TOKEN_NOT_FOUND1.1.0Delegation Token is not found on server.
63DELEGATION_TOKEN_OWNER_MISMATCH1.1.0Specified Principal is not valid Owner/Renewer.
64DELEGATION_TOKEN_REQUEST_NOT_ALLOWED1.1.0Delegation Token requests are not allowed on PLAINTEXT/1-way SSL channels and on delegation token authenticated channels.
65DELEGATION_TOKEN_AUTHORIZATION_FAILED1.1.0Delegation Token authorization failed.
66DELEGATION_TOKEN_EXPIRED1.1.0Delegation Token is expired.
67INVALID_PRINCIPAL_TYPE1.1.0Supplied principalType is not supported.
68NON_EMPTY_GROUP1.1.0The group is not empty.
69GROUP_ID_NOT_FOUND1.1.0The group id does not exist.
70FETCH_SESSION_ID_NOT_FOUND1.1.0The fetch session ID was not found.
71INVALID_FETCH_SESSION_EPOCH1.1.0The fetch session epoch is invalid.
72LISTENER_NOT_FOUND2.0.0There is no listener on the leader broker that matches the listener on which metadata request was processed.
73TOPIC_DELETION_DISABLED2.1.0Topic deletion is disabled.
74FENCED_LEADER_EPOCH2.1.0The leader epoch in the request is older than the epoch on the broker.
75UNKNOWN_LEADER_EPOCH2.1.0The leader epoch in the request is newer than the epoch on the broker.

CodeNameRetriableIntroducedMessage
76UNSUPPORTED_COMPRESSION_TYPE2.1.0The requesting client does not support the compression type of given partition.
77STALE_BROKER_EPOCH2.2.0Broker epoch has changed.
78OFFSET_NOT_AVAILABLE2.2.0The leader high watermark has not caught up from a recent leader election so the offsets cannot be guaranteed to be monotonically increasing.
79MEMBER_ID_REQUIRED2.2.0The group member needs to have a valid member id before actually entering a consumer group.
80PREFERRED_LEADER_NOT_AVAILABLE2.2.0The preferred leader was not available.
81GROUP_MAX_SIZE_REACHED2.2.0The group has reached its maximum size.
82FENCED_INSTANCE_ID2.3.0The broker rejected this static consumer since another consumer with the same group.instance.id has registered with a different member.id.
83ELIGIBLE_LEADERS_NOT_AVAILABLE2.4.0Eligible topic partition leaders are not available.
84ELECTION_NOT_NEEDED2.4.0Leader election not needed for topic partition.
85NO_REASSIGNMENT_IN_PROGRESS2.4.0No partition reassignment is in progress.
86GROUP_SUBSCRIBED_TO_TOPIC2.4.0Deleting offsets of a topic is forbidden while the consumer group is actively subscribed to it.
87INVALID_RECORD2.4.0This record has failed the validation on broker and hence will be rejected.
88UNSTABLE_OFFSET_COMMIT2.5.0There are unstable offsets that need to be cleared.
89THROTTLING_QUOTA_EXCEEDED2.7.0The throttling quota has been exceeded.
90PRODUCER_FENCED2.7.0There is a newer producer with the same transactionalId which fences the current one.
91RESOURCE_NOT_FOUND2.7.0A request illegally referred to a resource that does not exist.
92DUPLICATE_RESOURCE2.7.0A request illegally referred to the same resource twice.
93UNACCEPTABLE_CREDENTIAL2.7.0Requested credential would not meet criteria for acceptability.
94INCONSISTENT_VOTER_SET2.7.0Indicates that the either the sender or recipient of a voter-only request is not one of the expected voters.
95INVALID_UPDATE_VERSION2.7.0The given update version was invalid.
96FEATURE_UPDATE_FAILED2.7.0Unable to update finalized features due to an unexpected server error.
97PRINCIPAL_DESERIALIZATION_FAILURE2.8.0Request principal deserialization failed during forwarding. This indicates an internal error on the broker cluster security setup.
98SNAPSHOT_NOT_FOUND2.8.0Requested snapshot was not found.
99POSITION_OUT_OF_RANGE4.1.0Requested position is not greater than or equal to zero, and less than the size of the snapshot.
100UNKNOWN_TOPIC_ID2.8.0This server does not host this topic ID.

CodeNameRetriableIntroducedMessage
101DUPLICATE_BROKER_REGISTRATION2.8.0This broker ID is already in use.
102BROKER_ID_NOT_REGISTERED2.8.0The given broker ID was not registered.
103INCONSISTENT_TOPIC_ID2.8.0The log’s topic ID did not match the topic ID in the request.
104INCONSISTENT_CLUSTER_ID2.8.0The clusterId in the request does not match that found on the server.
105TRANSACTIONAL_ID_NOT_FOUND3.0.0The transactionalId could not be found.
106FETCH_SESSION_TOPIC_ID_ERROR3.1.0The fetch session encountered inconsistent topic ID usage.
107INELIGIBLE_REPLICA3.3.0The new ISR contains at least one ineligible replica.
108NEW_LEADER_ELECTED3.3.0The AlterPartition request successfully updated the partition state but the leader has changed.
109OFFSET_MOVED_TO_TIERED_STORAGE3.5.0The requested offset is moved to tiered storage.
110FENCED_MEMBER_EPOCH3.5.0The member epoch is fenced by the group coordinator. The member must abandon all its partitions and rejoin.
111UNRELEASED_INSTANCE_ID3.5.0The instance ID is still used by another member in the consumer group. That member must leave first.
112UNSUPPORTED_ASSIGNOR3.5.0The assignor or its version range is not supported by the consumer group.
113STALE_MEMBER_EPOCH3.6.0The member epoch is stale. The member must retry after receiving its updated member epoch via the ConsumerGroupHeartbeat API.
114MISMATCHED_ENDPOINT_TYPE3.7.0The request was sent to an endpoint of the wrong type.
115UNSUPPORTED_ENDPOINT_TYPE3.7.0This endpoint type is not supported yet.
116UNKNOWN_CONTROLLER_ID3.7.0This controller ID is not known.
117UNKNOWN_SUBSCRIPTION_ID3.7.0Client sent a push telemetry request with an invalid or outdated subscription ID.
118TELEMETRY_TOO_LARGE3.7.0Client sent a push telemetry request larger than the maximum size the broker will accept.
119INVALID_REGISTRATION3.7.0The controller has considered the broker registration to be invalid.
120TRANSACTION_ABORTABLE3.8.0The server encountered an error with the transaction. The client can abort the transaction to continue using this transactional ID.

CodeNameRetriableIntroducedMessage
121INVALID_RECORD_STATE3.9.0The record state is invalid. The acknowledgement of delivery could not be completed.
122SHARE_SESSION_NOT_FOUND3.9.0The share session was not found.
123INVALID_SHARE_SESSION_EPOCH3.9.0The share session epoch is invalid.
124FENCED_STATE_EPOCH3.9.0The share coordinator rejected the request because the share-group state epoch did not match.
125INVALID_VOTER_KEY3.9.0The voter key doesn’t match the receiving replica’s key.
126DUPLICATE_VOTER3.9.0The voter is already part of the set of voters.
127VOTER_NOT_FOUND3.9.0The voter is not part of the set of voters.
128INVALID_REGULAR_EXPRESSION4.0.0The regular expression is not valid.
129REBOOTSTRAP_REQUIRED4.0.0Client metadata is stale. The client should rebootstrap to obtain new metadata.
130STREAMS_INVALID_TOPOLOGY4.1.0The supplied topology is invalid.
131STREAMS_INVALID_TOPOLOGY_EPOCH4.1.0The supplied topology epoch is invalid.
132STREAMS_TOPOLOGY_FENCED4.1.0The supplied topology epoch is outdated.
133SHARE_SESSION_LIMIT_REACHED4.1.0The limit of share sessions has been reached.

Initial backoff = 100msMax backoff = 10sMax retries = 10Attempt = 0Send requestyesSuccess?Return resultyesRetriable error?noAttempt++Attempt >= Max retries?yesnoThrow exceptionWait(min(backoff * 2^attempt, max_backoff))Throw exceptiontrue

For errors 3, 5, 6, 74, 75, 100, 103:

Receive NOT_LEADER_OR_FOLLOWERInvalidate partition metadataRequest fresh metadataMetadata refresh successful?yesnoUpdate leader cacheRetry original requestApply backoffRetry metadata refresh

For errors 22, 25, 27, 82, 110:

Receive group erroryesREBALANCE_IN_PROGRESS?Mark pending rebalanceOn next poll, rejoinyesUNKNOWN_MEMBER_ID?Clear member IDRejoin with empty IDyesILLEGAL_GENERATION?Clear generationRejoin groupyesFENCED_INSTANCE_ID?Close consumerAlert application

Many Kafka response schemas include error information:

Response =>
throttle_time_ms: INT32
error_code: INT16
error_message: NULLABLE_STRING (when present)
FieldDescription
throttle_time_msClient should delay by this amount when present
error_codeError code (0 = success) when present
error_messageHuman-readable error description when present

Many APIs return per-partition errors:

PartitionResponse =>
partition_index: INT32
error_code: INT16
...

Clients must check error_code for each partition independently, even if a top-level error is not present.


When throttle_time_ms > 0:

RequirementLevel
Client should delay next request by throttle_time_msshould
Client may ignore throttle_time_msmay
Broker may reject requests during throttlemay

THROTTLING_QUOTA_EXCEEDED indicates the client has exceeded its quota:

Quota TypeScope
ProduceBytes/second (scope depends on quota configuration)
FetchBytes/second (scope depends on quota configuration)
RequestRequests/second (scope depends on quota configuration)

Each row includes an Introduced version derived from the first Kafka release tag where the error code appears in source. For 0.8.x this comes from core/src/main/scala/kafka/common/ErrorMapping.scala; for 0.9.0+ it comes from clients/src/main/java/org/apache/kafka/common/protocol/Errors.java.

Clients should handle unknown error codes gracefully:

if (error_code not recognized) {
treat as non-retriable
log error_code and error_message
report to application
}