Skip to content

Librdkafka Errors

Handling Non-Permanent and Permanent Errors from librdkafka

Most errors from librdkafka are non-permanent and are gracefully managed by internal retries, reducing the immediate impact on your application. These errors are generally not critical and often involve temporary issues such as a timed_out error, which indicates a delay in response or operation but does not necessarily signify a permanent problem. Those types of errors, while reported, usually resolve themselves through subsequent retries without requiring direct intervention.

Karafka also incorporates several recovery mechanisms that enable it to automatically reconnect and continue operations whenever possible, further enhancing the robustness of your message-handling processes.

Errors Classification

Internal errors (RD_KAFKA_RESP_ERR__) in librdkafka originate within the client library. They are often labeled as "Local" issues. In contrast, the Kafka broker generates broker errors (RD_KAFKA_RESP_ERR_). They are typically referred to as "Broker" issues, indicating problems on the server side.

Understanding whether an error is internal or from a broker is crucial for troubleshooting and resolving issues effectively:

  • Debugging: Knowing the error's source helps debug. If the error is internal, the issue must be resolved within the client environment (e.g., fixing configuration and updating the client library for bugs). If the error is from the broker, it might involve server configuration, network policies, or other aspects managed by the Kafka infrastructure.

  • Scalability and Reliability: By properly handling these errors, developers and operators can ensure the creation of more robust and scalable client applications. For instance, internal errors might require code changes or updates, while broker errors could lead to changes in how the client interacts with the Kafka ecosystem.

  • Operational Awareness: For operators and developers, the categorization of errors provides valuable insights into the health and status of both the Kafka client and the server, fostering informed operational decisions and monitoring strategies.

By categorizing errors this way, librdkafka provides a more straightforward interface for developers to handle, log, and react to various conditions affecting their applications' interaction with Apache Kafka.

Local Errors

Internal errors originate within the librdkafka client itself. They are not generated by interactions with the Kafka broker. Still, they are caused by issues within the client's processes and operations.

These errors are prefixed with two underscores (__) in their full error code names.

Code Symbol Name Description
-199:bad_msgRD_KAFKA_RESP_ERR__BAD_MSGLocal: Bad message format
-198:bad_compressionRD_KAFKA_RESP_ERR__BAD_COMPRESSIONLocal: Invalid compressed data
-197:destroyRD_KAFKA_RESP_ERR__DESTROYLocal: Broker handle destroyed
-196:failRD_KAFKA_RESP_ERR__FAILLocal: Communication failure with broker
-195:transportRD_KAFKA_RESP_ERR__TRANSPORTLocal: Broker transport failure
-194:crit_sys_resourceRD_KAFKA_RESP_ERR__CRIT_SYS_RESOURCELocal: Critical system resource failure
-193:resolveRD_KAFKA_RESP_ERR__RESOLVELocal: Host resolution failure
-192:msg_timed_outRD_KAFKA_RESP_ERR__MSG_TIMED_OUTLocal: Message timed out
-191:partition_eofRD_KAFKA_RESP_ERR__PARTITION_EOFBroker: No more messages
-190:unknown_partitionRD_KAFKA_RESP_ERR__UNKNOWN_PARTITIONLocal: Unknown partition
-189:fsRD_KAFKA_RESP_ERR__FSLocal: File or filesystem error
-188:unknown_topicRD_KAFKA_RESP_ERR__UNKNOWN_TOPICLocal: Unknown topic
-187:all_brokers_downRD_KAFKA_RESP_ERR__ALL_BROKERS_DOWNLocal: All broker connections are down
-186:invalid_argRD_KAFKA_RESP_ERR__INVALID_ARGLocal: Invalid argument or configuration
-185:timed_outRD_KAFKA_RESP_ERR__TIMED_OUTLocal: Timed out
-184:queue_fullRD_KAFKA_RESP_ERR__QUEUE_FULLLocal: Queue full
-183:isr_insuffRD_KAFKA_RESP_ERR__ISR_INSUFFLocal: ISR count insufficient
-182:node_updateRD_KAFKA_RESP_ERR__NODE_UPDATELocal: Broker node update
-181:sslRD_KAFKA_RESP_ERR__SSLLocal: SSL error
-180:wait_coordRD_KAFKA_RESP_ERR__WAIT_COORDLocal: Waiting for coordinator
-179:unknown_groupRD_KAFKA_RESP_ERR__UNKNOWN_GROUPLocal: Unknown group
-178:in_progressRD_KAFKA_RESP_ERR__IN_PROGRESSLocal: Operation in progress
-177:prev_in_progressRD_KAFKA_RESP_ERR__PREV_IN_PROGRESSLocal: Previous operation in progress
-176:existing_subscriptionRD_KAFKA_RESP_ERR__EXISTING_SUBSCRIPTIONLocal: Existing subscription
-175:assign_partitionsRD_KAFKA_RESP_ERR__ASSIGN_PARTITIONSLocal: Assign partitions
-174:revoke_partitionsRD_KAFKA_RESP_ERR__REVOKE_PARTITIONSLocal: Revoke partitions
-173:conflictRD_KAFKA_RESP_ERR__CONFLICTLocal: Conflicting use
-172:stateRD_KAFKA_RESP_ERR__STATELocal: Erroneous state
-171:unknown_protocolRD_KAFKA_RESP_ERR__UNKNOWN_PROTOCOLLocal: Unknown protocol
-170:not_implementedRD_KAFKA_RESP_ERR__NOT_IMPLEMENTEDLocal: Not implemented
-169:authenticationRD_KAFKA_RESP_ERR__AUTHENTICATIONLocal: Authentication failure
-168:no_offsetRD_KAFKA_RESP_ERR__NO_OFFSETLocal: No offset stored
-167:outdatedRD_KAFKA_RESP_ERR__OUTDATEDLocal: Outdated
-166:timed_out_queueRD_KAFKA_RESP_ERR__TIMED_OUT_QUEUELocal: Timed out in queue
-165:unsupported_featureRD_KAFKA_RESP_ERR__UNSUPPORTED_FEATURELocal: Required feature not supported by broker
-164:wait_cacheRD_KAFKA_RESP_ERR__WAIT_CACHELocal: Awaiting cache update
-163:intrRD_KAFKA_RESP_ERR__INTRLocal: Operation interrupted
-162:key_serializationRD_KAFKA_RESP_ERR__KEY_SERIALIZATIONLocal: Key serialization error
-161:value_serializationRD_KAFKA_RESP_ERR__VALUE_SERIALIZATIONLocal: Value serialization error
-160:key_deserializationRD_KAFKA_RESP_ERR__KEY_DESERIALIZATIONLocal: Key deserialization error
-159:value_deserializationRD_KAFKA_RESP_ERR__VALUE_DESERIALIZATIONLocal: Value deserialization error
-158:partialRD_KAFKA_RESP_ERR__PARTIALLocal: Partial response
-157:read_onlyRD_KAFKA_RESP_ERR__READ_ONLYLocal: Read-only object
-156:noentRD_KAFKA_RESP_ERR__NOENTLocal: No such entry
-155:underflowRD_KAFKA_RESP_ERR__UNDERFLOWLocal: Read underflow
-154:invalid_typeRD_KAFKA_RESP_ERR__INVALID_TYPELocal: Invalid type
-153:retryRD_KAFKA_RESP_ERR__RETRYLocal: Retry operation
-152:purge_queueRD_KAFKA_RESP_ERR__PURGE_QUEUELocal: Purged in queue
-151:purge_inflightRD_KAFKA_RESP_ERR__PURGE_INFLIGHTLocal: Purged in flight
-150:fatalRD_KAFKA_RESP_ERR__FATALLocal: Fatal error
-149:inconsistentRD_KAFKA_RESP_ERR__INCONSISTENTLocal: Inconsistent state
-148:gapless_guaranteeRD_KAFKA_RESP_ERR__GAPLESS_GUARANTEELocal: Gap-less ordering would not be guaranteed if proceeding
-147:max_poll_exceededRD_KAFKA_RESP_ERR__MAX_POLL_EXCEEDEDLocal: Maximum application poll interval (max.poll.interval.ms) exceeded
-146:unknown_brokerRD_KAFKA_RESP_ERR__UNKNOWN_BROKERLocal: Unknown broker
-145:not_configuredRD_KAFKA_RESP_ERR__NOT_CONFIGUREDLocal: Functionality not configured
-144:fencedRD_KAFKA_RESP_ERR__FENCEDLocal: This instance has been fenced by a newer instance
-143:applicationRD_KAFKA_RESP_ERR__APPLICATIONLocal: Application generated error
-142:assignment_lostRD_KAFKA_RESP_ERR__ASSIGNMENT_LOSTLocal: Group partition assignment lost
-141:noopRD_KAFKA_RESP_ERR__NOOPLocal: No operation performed
-140:auto_offset_resetRD_KAFKA_RESP_ERR__AUTO_OFFSET_RESETLocal: No offset to automatically reset to
-139:log_truncationRD_KAFKA_RESP_ERR__LOG_TRUNCATIONLocal: Partition log truncation detected

Broker Errors

Broker errors are those reported by the Kafka broker to the librdkafka client. These errors arise from the server side of Kafka operations and are relayed back to the client during normal communication.

These errors are prefixed with a single underscore (_) in their error code names.

Code Symbol Name Description
1:offset_out_of_rangeRD_KAFKA_RESP_ERR_OFFSET_OUT_OF_RANGEBroker: Offset out of range
2:invalid_msgRD_KAFKA_RESP_ERR_INVALID_MSGBroker: Invalid message
3:unknown_topic_or_partRD_KAFKA_RESP_ERR_UNKNOWN_TOPIC_OR_PARTBroker: Unknown topic or partition
4:invalid_msg_sizeRD_KAFKA_RESP_ERR_INVALID_MSG_SIZEBroker: Invalid message size
5:leader_not_availableRD_KAFKA_RESP_ERR_LEADER_NOT_AVAILABLEBroker: Leader not available
6:not_leader_for_partitionRD_KAFKA_RESP_ERR_NOT_LEADER_FOR_PARTITIONBroker: Not leader for partition
7:request_timed_outRD_KAFKA_RESP_ERR_REQUEST_TIMED_OUTBroker: Request timed out
8:broker_not_availableRD_KAFKA_RESP_ERR_BROKER_NOT_AVAILABLEBroker: Broker not available
9:replica_not_availableRD_KAFKA_RESP_ERR_REPLICA_NOT_AVAILABLEBroker: Replica not available
10:msg_size_too_largeRD_KAFKA_RESP_ERR_MSG_SIZE_TOO_LARGEBroker: Message size too large
11:stale_ctrl_epochRD_KAFKA_RESP_ERR_STALE_CTRL_EPOCHBroker: StaleControllerEpochCode
12:offset_metadata_too_largeRD_KAFKA_RESP_ERR_OFFSET_METADATA_TOO_LARGEBroker: Offset metadata string too large
13:network_exceptionRD_KAFKA_RESP_ERR_NETWORK_EXCEPTIONBroker: Broker disconnected before response received
14:coordinator_load_in_progressRD_KAFKA_RESP_ERR_COORDINATOR_LOAD_IN_PROGRESSBroker: Coordinator load in progress
15:coordinator_not_availableRD_KAFKA_RESP_ERR_COORDINATOR_NOT_AVAILABLEBroker: Coordinator not available
16:not_coordinatorRD_KAFKA_RESP_ERR_NOT_COORDINATORBroker: Not coordinator
17:topic_exceptionRD_KAFKA_RESP_ERR_TOPIC_EXCEPTIONBroker: Invalid topic
18:record_list_too_largeRD_KAFKA_RESP_ERR_RECORD_LIST_TOO_LARGEBroker: Message batch larger than configured server segment size
19:not_enough_replicasRD_KAFKA_RESP_ERR_NOT_ENOUGH_REPLICASBroker: Not enough in-sync replicas
20:not_enough_replicas_after_appendRD_KAFKA_RESP_ERR_NOT_ENOUGH_REPLICAS_AFTER_APPENDBroker: Message(s) written to insufficient number of in-sync replicas
21:invalid_required_acksRD_KAFKA_RESP_ERR_INVALID_REQUIRED_ACKSBroker: Invalid required acks value
22:illegal_generationRD_KAFKA_RESP_ERR_ILLEGAL_GENERATIONBroker: Specified group generation id is not valid
23:inconsistent_group_protocolRD_KAFKA_RESP_ERR_INCONSISTENT_GROUP_PROTOCOLBroker: Inconsistent group protocol
24:invalid_group_idRD_KAFKA_RESP_ERR_INVALID_GROUP_IDBroker: Invalid group.id
25:unknown_member_idRD_KAFKA_RESP_ERR_UNKNOWN_MEMBER_IDBroker: Unknown member
26:invalid_session_timeoutRD_KAFKA_RESP_ERR_INVALID_SESSION_TIMEOUTBroker: Invalid session timeout
27:rebalance_in_progressRD_KAFKA_RESP_ERR_REBALANCE_IN_PROGRESSBroker: Group rebalance in progress
28:invalid_commit_offset_sizeRD_KAFKA_RESP_ERR_INVALID_COMMIT_OFFSET_SIZEBroker: Commit offset data size is not valid
29:topic_authorization_failedRD_KAFKA_RESP_ERR_TOPIC_AUTHORIZATION_FAILEDBroker: Topic authorization failed
30:group_authorization_failedRD_KAFKA_RESP_ERR_GROUP_AUTHORIZATION_FAILEDBroker: Group authorization failed
31:cluster_authorization_failedRD_KAFKA_RESP_ERR_CLUSTER_AUTHORIZATION_FAILEDBroker: Cluster authorization failed
32:invalid_timestampRD_KAFKA_RESP_ERR_INVALID_TIMESTAMPBroker: Invalid timestamp
33:unsupported_sasl_mechanismRD_KAFKA_RESP_ERR_UNSUPPORTED_SASL_MECHANISMBroker: Unsupported SASL mechanism
34:illegal_sasl_stateRD_KAFKA_RESP_ERR_ILLEGAL_SASL_STATEBroker: Request not valid in current SASL state
35:unsupported_versionRD_KAFKA_RESP_ERR_UNSUPPORTED_VERSIONBroker: API version not supported
36:topic_already_existsRD_KAFKA_RESP_ERR_TOPIC_ALREADY_EXISTSBroker: Topic already exists
37:invalid_partitionsRD_KAFKA_RESP_ERR_INVALID_PARTITIONSBroker: Invalid number of partitions
38:invalid_replication_factorRD_KAFKA_RESP_ERR_INVALID_REPLICATION_FACTORBroker: Invalid replication factor
39:invalid_replica_assignmentRD_KAFKA_RESP_ERR_INVALID_REPLICA_ASSIGNMENTBroker: Invalid replica assignment
40:invalid_configRD_KAFKA_RESP_ERR_INVALID_CONFIGBroker: Configuration is invalid
41:not_controllerRD_KAFKA_RESP_ERR_NOT_CONTROLLERBroker: Not controller for cluster
42:invalid_requestRD_KAFKA_RESP_ERR_INVALID_REQUESTBroker: Invalid request
43:unsupported_for_message_formatRD_KAFKA_RESP_ERR_UNSUPPORTED_FOR_MESSAGE_FORMATBroker: Message format on broker does not support request
44:policy_violationRD_KAFKA_RESP_ERR_POLICY_VIOLATIONBroker: Policy violation
45:out_of_order_sequence_numberRD_KAFKA_RESP_ERR_OUT_OF_ORDER_SEQUENCE_NUMBERBroker: Broker received an out of order sequence number
46:duplicate_sequence_numberRD_KAFKA_RESP_ERR_DUPLICATE_SEQUENCE_NUMBERBroker: Broker received a duplicate sequence number
47:invalid_producer_epochRD_KAFKA_RESP_ERR_INVALID_PRODUCER_EPOCHBroker: Producer attempted an operation with an old epoch
48:invalid_txn_stateRD_KAFKA_RESP_ERR_INVALID_TXN_STATEBroker: Producer attempted a transactional operation in an invalid state
49:invalid_producer_id_mappingRD_KAFKA_RESP_ERR_INVALID_PRODUCER_ID_MAPPINGBroker: Producer attempted to use a producer id which is not currently assigned to its transactional id
50:invalid_transaction_timeoutRD_KAFKA_RESP_ERR_INVALID_TRANSACTION_TIMEOUTBroker: Transaction timeout is larger than the maximum value allowed by the broker's max.transaction.timeout.ms
51:concurrent_transactionsRD_KAFKA_RESP_ERR_CONCURRENT_TRANSACTIONSBroker: Producer attempted to update a transaction while another concurrent operation on the same transaction was ongoing
52:transaction_coordinator_fencedRD_KAFKA_RESP_ERR_TRANSACTION_COORDINATOR_FENCEDBroker: Indicates that the transaction coordinator sending a WriteTxnMarker is no longer the current coordinator for a given producer
53:transactional_id_authorization_failedRD_KAFKA_RESP_ERR_TRANSACTIONAL_ID_AUTHORIZATION_FAILEDBroker: Transactional Id authorization failed
54:security_disabledRD_KAFKA_RESP_ERR_SECURITY_DISABLEDBroker: Security features are disabled
55:operation_not_attemptedRD_KAFKA_RESP_ERR_OPERATION_NOT_ATTEMPTEDBroker: Operation not attempted
56:kafka_storage_errorRD_KAFKA_RESP_ERR_KAFKA_STORAGE_ERRORBroker: Disk error when trying to access log file on disk
57:log_dir_not_foundRD_KAFKA_RESP_ERR_LOG_DIR_NOT_FOUNDBroker: The user-specified log directory is not found in the broker config
58:sasl_authentication_failedRD_KAFKA_RESP_ERR_SASL_AUTHENTICATION_FAILEDBroker: SASL Authentication failed
59:unknown_producer_idRD_KAFKA_RESP_ERR_UNKNOWN_PRODUCER_IDBroker: Unknown Producer Id
60:reassignment_in_progressRD_KAFKA_RESP_ERR_REASSIGNMENT_IN_PROGRESSBroker: Partition reassignment is in progress
61:delegation_token_auth_disabledRD_KAFKA_RESP_ERR_DELEGATION_TOKEN_AUTH_DISABLEDBroker: Delegation Token feature is not enabled
62:delegation_token_not_foundRD_KAFKA_RESP_ERR_DELEGATION_TOKEN_NOT_FOUNDBroker: Delegation Token is not found on server
63:delegation_token_owner_mismatchRD_KAFKA_RESP_ERR_DELEGATION_TOKEN_OWNER_MISMATCHBroker: Specified Principal is not valid Owner/Renewer
64:delegation_token_request_not_allowedRD_KAFKA_RESP_ERR_DELEGATION_TOKEN_REQUEST_NOT_ALLOWEDBroker: Delegation Token requests are not allowed on this connection
65:delegation_token_authorization_failedRD_KAFKA_RESP_ERR_DELEGATION_TOKEN_AUTHORIZATION_FAILEDBroker: Delegation Token authorization failed
66:delegation_token_expiredRD_KAFKA_RESP_ERR_DELEGATION_TOKEN_EXPIREDBroker: Delegation Token is expired
67:invalid_principal_typeRD_KAFKA_RESP_ERR_INVALID_PRINCIPAL_TYPEBroker: Supplied principalType is not supported
68:non_empty_groupRD_KAFKA_RESP_ERR_NON_EMPTY_GROUPBroker: The group is not empty
69:group_id_not_foundRD_KAFKA_RESP_ERR_GROUP_ID_NOT_FOUNDBroker: The group id does not exist
70:fetch_session_id_not_foundRD_KAFKA_RESP_ERR_FETCH_SESSION_ID_NOT_FOUNDBroker: The fetch session ID was not found
71:invalid_fetch_session_epochRD_KAFKA_RESP_ERR_INVALID_FETCH_SESSION_EPOCHBroker: The fetch session epoch is invalid
72:listener_not_foundRD_KAFKA_RESP_ERR_LISTENER_NOT_FOUNDBroker: No matching listener
73:topic_deletion_disabledRD_KAFKA_RESP_ERR_TOPIC_DELETION_DISABLEDBroker: Topic deletion is disabled
74:fenced_leader_epochRD_KAFKA_RESP_ERR_FENCED_LEADER_EPOCHBroker: Leader epoch is older than broker epoch
75:unknown_leader_epochRD_KAFKA_RESP_ERR_UNKNOWN_LEADER_EPOCHBroker: Leader epoch is newer than broker epoch
76:unsupported_compression_typeRD_KAFKA_RESP_ERR_UNSUPPORTED_COMPRESSION_TYPEBroker: Unsupported compression type
77:stale_broker_epochRD_KAFKA_RESP_ERR_STALE_BROKER_EPOCHBroker: Broker epoch has changed
78:offset_not_availableRD_KAFKA_RESP_ERR_OFFSET_NOT_AVAILABLEBroker: Leader high watermark is not caught up
79:member_id_requiredRD_KAFKA_RESP_ERR_MEMBER_ID_REQUIREDBroker: Group member needs a valid member ID
80:preferred_leader_not_availableRD_KAFKA_RESP_ERR_PREFERRED_LEADER_NOT_AVAILABLEBroker: Preferred leader was not available
81:group_max_size_reachedRD_KAFKA_RESP_ERR_GROUP_MAX_SIZE_REACHEDBroker: Consumer group has reached maximum size
82:fenced_instance_idRD_KAFKA_RESP_ERR_FENCED_INSTANCE_IDBroker: Static consumer fenced by other consumer with same group.instance.id
83:eligible_leaders_not_availableRD_KAFKA_RESP_ERR_ELIGIBLE_LEADERS_NOT_AVAILABLEBroker: Eligible partition leaders are not available
84:election_not_neededRD_KAFKA_RESP_ERR_ELECTION_NOT_NEEDEDBroker: Leader election not needed for topic partition
85:no_reassignment_in_progressRD_KAFKA_RESP_ERR_NO_REASSIGNMENT_IN_PROGRESSBroker: No partition reassignment is in progress
86:group_subscribed_to_topicRD_KAFKA_RESP_ERR_GROUP_SUBSCRIBED_TO_TOPICBroker: Deleting offsets of a topic while the consumer group is subscribed to it
87:invalid_recordRD_KAFKA_RESP_ERR_INVALID_RECORDBroker: Broker failed to validate record
88:unstable_offset_commitRD_KAFKA_RESP_ERR_UNSTABLE_OFFSET_COMMITBroker: There are unstable offsets that need to be cleared
89:throttling_quota_exceededRD_KAFKA_RESP_ERR_THROTTLING_QUOTA_EXCEEDEDBroker: Throttling quota has been exceeded
90:producer_fencedRD_KAFKA_RESP_ERR_PRODUCER_FENCEDBroker: There is a newer producer with the same transactionalId which fences the current one
91:resource_not_foundRD_KAFKA_RESP_ERR_RESOURCE_NOT_FOUNDBroker: Request illegally referred to resource that does not exist
92:duplicate_resourceRD_KAFKA_RESP_ERR_DUPLICATE_RESOURCEBroker: Request illegally referred to the same resource twice
93:unacceptable_credentialRD_KAFKA_RESP_ERR_UNACCEPTABLE_CREDENTIALBroker: Requested credential would not meet criteria for acceptability
94:inconsistent_voter_setRD_KAFKA_RESP_ERR_INCONSISTENT_VOTER_SETBroker: Indicates that the either the sender or recipient of a voter-only request is not one of the expected voters
95:invalid_update_versionRD_KAFKA_RESP_ERR_INVALID_UPDATE_VERSIONBroker: Invalid update version
96:feature_update_failedRD_KAFKA_RESP_ERR_FEATURE_UPDATE_FAILEDBroker: Unable to update finalized features due to server error
97:principal_deserialization_failureRD_KAFKA_RESP_ERR_PRINCIPAL_DESERIALIZATION_FAILUREBroker: Request principal deserialization failed during forwarding