Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

API name

ApiKey Value

ProduceRequest

0

FetchRequest

1

OffsetRequest

2

MetadataRequest

3

Non-user facing control APIs

4-7

OffsetCommitRequest

8

OffsetFetchRequest

9

ConsumerMetadataRequestGroupCoordinatorRequest10
JoinGroupRequest

11

HeartbeatRequest12
LeaveGroupRequest13
SyncGroupRequest14
DescribeGroupsRequest15
ListGroupsRequest16
Error Codes

We use numeric codes to indicate what problem occurred on the server. These can be translated by the client into exceptions or whatever the appropriate error handling mechanism in the client language. Here is a table of the error codes currently in use:

Error

Code

Description

NoError

0

No error--it worked!

Unknown

-1

An unexpected server error

OffsetOutOfRange

1

The requested offset is outside the range of offsets maintained by the server for the given topic/partition.

InvalidMessage

2

This indicates that a message contents does not match its CRC

UnknownTopicOrPartition

3

This request is for a topic or partition that does not exist on this broker.

InvalidMessageSize

4

The message has a negative size

LeaderNotAvailable

5

This error is thrown if we are in the middle of a leadership election and there is currently no leader for this partition and hence it is unavailable for writes.

NotLeaderForPartition

6

This error is thrown if the client attempts to send messages to a replica that is not the leader for some partition. It indicates that the clients metadata is out of date.

RequestTimedOut

7

This error is thrown if the request exceeds the user-specified time limit in the request.

BrokerNotAvailable

8

This is not a client facing error and is used mostly by tools when a broker is not alive.

ReplicaNotAvailable

9

If replica is expected on a broker, but is not (this can be safely ignored).

MessageSizeTooLarge

10

The server has a configurable maximum message size to avoid unbounded memory allocation. This error is thrown if the client attempt to produce a message larger than this maximum.

StaleControllerEpochCode

11

Internal error code for broker-to-broker communication.

OffsetMetadataTooLargeCode

12

If you specify a string larger than configured maximum for offset metadata

OffsetsLoadInProgressCodeGroupLoadInProgressCode14The broker returns this error code for an offset fetch request if it is still loading offsets (after a leader change for that offsets topic partition), or in response to group membership requests (such as heartbeats) when group metadata is being loaded by the coordinator.
ConsumerCoordinatorNotAvailableCodeGroupCoordinatorNotAvailableCode15The broker returns this error code for consumer metadata group coordinator requests or offset commit , offset commits, and most group management requests if the offsets topic has not yet been created, or if the group coordinator is not active.
NotCoordinatorForConsumerCodeNotCoordinatorForGroupCode16The broker returns this error code if it receives an offset fetch or commit request for a consumer group that it is not a coordinator for.
InvalidTopicCode17For a request which attempts to access an invalid topic (e.g. one which has an illegal name), or if an attempt is made to write to an internal topic (such as the consumer offsets topic).
RecordListTooLargeCode18If a message batch in a produce request exceeds the maximum configured segment size.
NotEnoughReplicasCode19Returned from a produce request when the number of in-sync replicas is lower than the configured minimum and requiredAcks is -1.
NotEnoughReplicasAfterAppendCode20Returned from a produce request when the message was written to the log, but with fewer in-sync replicas than required.
InvalidRequiredAcksCode21Returned from a produce request if the requested requiredAcks is invalid (anything other than -1, 1, or 0).
IllegalGenerationCode22Returned from group membership requests (such as heartbeats) when the generation id provided in the request is not the current generation.
InconsistentGroupProtocolCode23Returned in join group when the member provides a protocol type or set of protocols which is not compatible with the current group.
InvalidGroupIdCode24Returned in join group when the groupId is empty or null.
UnknownMemberIdCode25Returned from group requests (offset commits/fetches, heartbeats, etc) when the memberId is not in the current generation.
InvalidSessionTimeoutCode26Return in join group when the requested session timeout is outside of the allowed range on the broker
RebalanceInProgressCode27Returned in heartbeat requests when the coordinator has begun rebalancing the group. This indicates to the client that it should rejoin the group.
InvalidCommitOffsetSizeCode28This error indicates that an offset commit was rejected because of oversize metadata.
TopicAuthorizationFailedCode29Returned by the broker when the client is not authorized to access the requested topic.
GroupAuthorizationFailedCode30Returned by the broker when the client is not authorized to access a particular groupId.
ClusterAuthorizationFailedCode31Returned by the broker when the client is not authorized to use an inter-broker or administrative API.

Some Common Philosophical Questions

...