Hi Nikita, The errors may be caused by the clients, but they are detected and announced by the server (broker).
It is not always a server issue, the error codes sometimes indicate issues caused by the clients. However, it is the server that detects and notifies the clients of those issues when expectations are not met. Think of this as an ATM or bank teller scenario, where a customer goes to the bank or ATM to withdraw or deposit some money and the transaction has problems and the ATM or bank representative will inform the customer of the issue(s). If the customer enters an incorrect PIN, attempting to deposit counterfeit currency or perform any other invalid transaction, the notification comes from the bank and usually not the customer (client). Sometimes, the bank may be unable to perform the transaction because they don't have enough cash in the ATM in which case it is not the customer's fault but that of the bank (server). It is important to note here that the issue is not always caused by the bank (server). However, the bank (server) is the one that notifies the customer (client) of the issue such as invalid PIN caused by the customer or lack of sufficient cash issue caused by the bank. If you carefully review the error codes, you will notice that some of the codes like 2 (CORRUPT_MESSAGE), 4 (INVALID_FETCH_SIZE), 10 (MESSAGE_TOO_LARGE), 18 (RECORD_LIST_TOO_LARGE) and 21 (INVALID_REQUIRED_ACKS) are issues that are caused by the clients but detected by the server. On the other hand, some error codes like 60 (REASSIGNMENT_IN_PROGRESS) and 5 (LEADER_NOT_AVAILABLE) indicate issues at the server not caused by the clients. https://kafka.apache.org/protocol.html#protocol_error_codes I hope this helps. On Wed, Apr 28, 2021 at 2:29 PM Nikita Kretov <kretov...@gmail.com> wrote: > Thank you all for answers! > Israel Ekpo, you clarification is really helpful for me. After studying > protocol documentation closely, i indeed can agree with you about server > side nature of error with types (8,8,15,56,72). But do you think error > with code 2 ```CORRUPT_MESSAGE``` is a server side problem indicator? > > > > On 4/28/21 6:12 PM, Israel Ekpo wrote: > > https://kafka.apache.org/protocol.html#protocol_error_codes > > > > According to the documentation, those numeric codes are special because > > they are used within the Kafka protocol to indicate problems that are > > observed at the server. > > > > These special numeric codes can be translated by the client into > exceptions > > or whatever the appropriate error handling mechanism in the client > language. > > > > Unless you are implementing or maintaining a client library that > interacts > > with the server using the Kafka protocol, you do not have to be concerned > > with those codes. > > > > Your client library should understand the protocol and throw the > > appropriate exception/error condition while in use. > > > > See the following examples of how these errors are handled at the > clients: > > > https://kafka.apache.org/28/javadoc/org/apache/kafka/common/errors/package-summary.html > > > https://github.com/confluentinc/confluent-kafka-dotnet/blob/master/src/Confluent.Kafka/ErrorCode.cs > > https://github.com/edenhill/librdkafka/blob/master/src/rdkafka_error.h > > > https://github.com/confluentinc/confluent-kafka-python/blob/master/src/confluent_kafka/error.py > > https://kafka.apache.org/protocol.html#protocol_error_codes > > > > > > > > On Wed, Apr 28, 2021 at 10:07 AM Men Lim <zulu...@gmail.com> wrote: > > > >> that article linked to apache error code, which tells you their meaning. > >> > >> https://kafka.apache.org/protocol.html#protocol_error_codes > >> > >> On Wed, Apr 28, 2021 at 6:44 AM Nikita Kretov <kretov...@gmail.com> > wrote: > >> > >>> I'm doing little research about what metrics and formulas used to > >>> calculate SLA for kafka clusters. I found that some of major cloud > >>> providers offer managed kafka solutions. for example - aws msk (Amazon > >>> Managed Streaming for Apache Kafka) > >>> > >>> Interestingly, aws msk SLA document defines ``Error``` as ```...any > >>> Apache Kafka API Request that returns the 2, 8, 9, 15, 56, 72 error > >>> codes, or an Apache Kafka API Request that upon retry returns the 19 > and > >>> 20 error codes as described in the Apache Kafka site...``` (from > >>> https://aws.amazon.com/msk/sla/ ) > >>> So my question is - Does someone know what's so special about this > >>> specific error codes ? > >>> > >>> Thank you. > >>> > >> > > >