errors.go 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457
  1. package sarama
  2. import (
  3. "errors"
  4. "fmt"
  5. "strings"
  6. "github.com/hashicorp/go-multierror"
  7. )
  8. // ErrOutOfBrokers is the error returned when the client has run out of brokers to talk to because all of them errored
  9. // or otherwise failed to respond.
  10. var ErrOutOfBrokers = errors.New("kafka: client has run out of available brokers to talk to")
  11. // ErrBrokerNotFound is the error returned when there's no broker found for the requested ID.
  12. var ErrBrokerNotFound = errors.New("kafka: broker for ID is not found")
  13. // ErrClosedClient is the error returned when a method is called on a client that has been closed.
  14. var ErrClosedClient = errors.New("kafka: tried to use a client that was closed")
  15. // ErrIncompleteResponse is the error returned when the server returns a syntactically valid response, but it does
  16. // not contain the expected information.
  17. var ErrIncompleteResponse = errors.New("kafka: response did not contain all the expected topic/partition blocks")
  18. // ErrInvalidPartition is the error returned when a partitioner returns an invalid partition index
  19. // (meaning one outside of the range [0...numPartitions-1]).
  20. var ErrInvalidPartition = errors.New("kafka: partitioner returned an invalid partition index")
  21. // ErrAlreadyConnected is the error returned when calling Open() on a Broker that is already connected or connecting.
  22. var ErrAlreadyConnected = errors.New("kafka: broker connection already initiated")
  23. // ErrNotConnected is the error returned when trying to send or call Close() on a Broker that is not connected.
  24. var ErrNotConnected = errors.New("kafka: broker not connected")
  25. // ErrInsufficientData is returned when decoding and the packet is truncated. This can be expected
  26. // when requesting messages, since as an optimization the server is allowed to return a partial message at the end
  27. // of the message set.
  28. var ErrInsufficientData = errors.New("kafka: insufficient data to decode packet, more bytes expected")
  29. // ErrShuttingDown is returned when a producer receives a message during shutdown.
  30. var ErrShuttingDown = errors.New("kafka: message received by producer in process of shutting down")
  31. // ErrMessageTooLarge is returned when the next message to consume is larger than the configured Consumer.Fetch.Max
  32. var ErrMessageTooLarge = errors.New("kafka: message is larger than Consumer.Fetch.Max")
  33. // ErrConsumerOffsetNotAdvanced is returned when a partition consumer didn't advance its offset after parsing
  34. // a RecordBatch.
  35. var ErrConsumerOffsetNotAdvanced = errors.New("kafka: consumer offset was not advanced after a RecordBatch")
  36. // ErrControllerNotAvailable is returned when server didn't give correct controller id. May be kafka server's version
  37. // is lower than 0.10.0.0.
  38. var ErrControllerNotAvailable = errors.New("kafka: controller is not available")
  39. // ErrNoTopicsToUpdateMetadata is returned when Meta.Full is set to false but no specific topics were found to update
  40. // the metadata.
  41. var ErrNoTopicsToUpdateMetadata = errors.New("kafka: no specific topics to update metadata")
  42. // ErrUnknownScramMechanism is returned when user tries to AlterUserScramCredentials with unknown SCRAM mechanism
  43. var ErrUnknownScramMechanism = errors.New("kafka: unknown SCRAM mechanism provided")
  44. // ErrReassignPartitions is returned when altering partition assignments for a topic fails
  45. var ErrReassignPartitions = errors.New("failed to reassign partitions for topic")
  46. // ErrDeleteRecords is the type of error returned when fail to delete the required records
  47. var ErrDeleteRecords = errors.New("kafka server: failed to delete records")
  48. // ErrCreateACLs is the type of error returned when ACL creation failed
  49. var ErrCreateACLs = errors.New("kafka server: failed to create one or more ACL rules")
  50. // ErrAddPartitionsToTxn is returned when AddPartitionsToTxn failed multiple times
  51. var ErrAddPartitionsToTxn = errors.New("transaction manager: failed to send partitions to transaction")
  52. // ErrTxnOffsetCommit is returned when TxnOffsetCommit failed multiple times
  53. var ErrTxnOffsetCommit = errors.New("transaction manager: failed to send offsets to transaction")
  54. // ErrTransactionNotReady when transaction status is invalid for the current action.
  55. var ErrTransactionNotReady = errors.New("transaction manager: transaction is not ready")
  56. // ErrNonTransactedProducer when calling BeginTxn, CommitTxn or AbortTxn on a non transactional producer.
  57. var ErrNonTransactedProducer = errors.New("transaction manager: you need to add TransactionalID to producer")
  58. // ErrTransitionNotAllowed when txnmgr state transition is not valid.
  59. var ErrTransitionNotAllowed = errors.New("transaction manager: invalid transition attempted")
  60. // ErrCannotTransitionNilError when transition is attempted with an nil error.
  61. var ErrCannotTransitionNilError = errors.New("transaction manager: cannot transition with a nil error")
  62. // ErrTxnUnableToParseResponse when response is nil
  63. var ErrTxnUnableToParseResponse = errors.New("transaction manager: unable to parse response")
  64. // MultiErrorFormat specifies the formatter applied to format multierrors. The
  65. // default implementation is a condensed version of the hashicorp/go-multierror
  66. // default one
  67. var MultiErrorFormat multierror.ErrorFormatFunc = func(es []error) string {
  68. if len(es) == 1 {
  69. return es[0].Error()
  70. }
  71. points := make([]string, len(es))
  72. for i, err := range es {
  73. points[i] = fmt.Sprintf("* %s", err)
  74. }
  75. return fmt.Sprintf(
  76. "%d errors occurred:\n\t%s\n",
  77. len(es), strings.Join(points, "\n\t"))
  78. }
  79. type sentinelError struct {
  80. sentinel error
  81. wrapped error
  82. }
  83. func (err sentinelError) Error() string {
  84. if err.wrapped != nil {
  85. return fmt.Sprintf("%s: %v", err.sentinel, err.wrapped)
  86. } else {
  87. return fmt.Sprintf("%s", err.sentinel)
  88. }
  89. }
  90. func (err sentinelError) Is(target error) bool {
  91. return errors.Is(err.sentinel, target) || errors.Is(err.wrapped, target)
  92. }
  93. func (err sentinelError) Unwrap() error {
  94. return err.wrapped
  95. }
  96. func Wrap(sentinel error, wrapped ...error) sentinelError {
  97. return sentinelError{sentinel: sentinel, wrapped: multiError(wrapped...)}
  98. }
  99. func multiError(wrapped ...error) error {
  100. merr := multierror.Append(nil, wrapped...)
  101. if MultiErrorFormat != nil {
  102. merr.ErrorFormat = MultiErrorFormat
  103. }
  104. return merr.ErrorOrNil()
  105. }
  106. // PacketEncodingError is returned from a failure while encoding a Kafka packet. This can happen, for example,
  107. // if you try to encode a string over 2^15 characters in length, since Kafka's encoding rules do not permit that.
  108. type PacketEncodingError struct {
  109. Info string
  110. }
  111. func (err PacketEncodingError) Error() string {
  112. return fmt.Sprintf("kafka: error encoding packet: %s", err.Info)
  113. }
  114. // PacketDecodingError is returned when there was an error (other than truncated data) decoding the Kafka broker's response.
  115. // This can be a bad CRC or length field, or any other invalid value.
  116. type PacketDecodingError struct {
  117. Info string
  118. }
  119. func (err PacketDecodingError) Error() string {
  120. return fmt.Sprintf("kafka: error decoding packet: %s", err.Info)
  121. }
  122. // ConfigurationError is the type of error returned from a constructor (e.g. NewClient, or NewConsumer)
  123. // when the specified configuration is invalid.
  124. type ConfigurationError string
  125. func (err ConfigurationError) Error() string {
  126. return "kafka: invalid configuration (" + string(err) + ")"
  127. }
  128. // KError is the type of error that can be returned directly by the Kafka broker.
  129. // See https://cwiki.apache.org/confluence/display/KAFKA/A+Guide+To+The+Kafka+Protocol#AGuideToTheKafkaProtocol-ErrorCodes
  130. type KError int16
  131. // Numeric error codes returned by the Kafka server.
  132. const (
  133. ErrUnknown KError = -1 // Errors.UNKNOWN_SERVER_ERROR
  134. ErrNoError KError = 0 // Errors.NONE
  135. ErrOffsetOutOfRange KError = 1 // Errors.OFFSET_OUT_OF_RANGE
  136. ErrInvalidMessage KError = 2 // Errors.CORRUPT_MESSAGE
  137. ErrUnknownTopicOrPartition KError = 3 // Errors.UNKNOWN_TOPIC_OR_PARTITION
  138. ErrInvalidMessageSize KError = 4 // Errors.INVALID_FETCH_SIZE
  139. ErrLeaderNotAvailable KError = 5 // Errors.LEADER_NOT_AVAILABLE
  140. ErrNotLeaderForPartition KError = 6 // Errors.NOT_LEADER_OR_FOLLOWER
  141. ErrRequestTimedOut KError = 7 // Errors.REQUEST_TIMED_OUT
  142. ErrBrokerNotAvailable KError = 8 // Errors.BROKER_NOT_AVAILABLE
  143. ErrReplicaNotAvailable KError = 9 // Errors.REPLICA_NOT_AVAILABLE
  144. ErrMessageSizeTooLarge KError = 10 // Errors.MESSAGE_TOO_LARGE
  145. ErrStaleControllerEpochCode KError = 11 // Errors.STALE_CONTROLLER_EPOCH
  146. ErrOffsetMetadataTooLarge KError = 12 // Errors.OFFSET_METADATA_TOO_LARGE
  147. ErrNetworkException KError = 13 // Errors.NETWORK_EXCEPTION
  148. ErrOffsetsLoadInProgress KError = 14 // Errors.COORDINATOR_LOAD_IN_PROGRESS
  149. ErrConsumerCoordinatorNotAvailable KError = 15 // Errors.COORDINATOR_NOT_AVAILABLE
  150. ErrNotCoordinatorForConsumer KError = 16 // Errors.NOT_COORDINATOR
  151. ErrInvalidTopic KError = 17 // Errors.INVALID_TOPIC_EXCEPTION
  152. ErrMessageSetSizeTooLarge KError = 18 // Errors.RECORD_LIST_TOO_LARGE
  153. ErrNotEnoughReplicas KError = 19 // Errors.NOT_ENOUGH_REPLICAS
  154. ErrNotEnoughReplicasAfterAppend KError = 20 // Errors.NOT_ENOUGH_REPLICAS_AFTER_APPEND
  155. ErrInvalidRequiredAcks KError = 21 // Errors.INVALID_REQUIRED_ACKS
  156. ErrIllegalGeneration KError = 22 // Errors.ILLEGAL_GENERATION
  157. ErrInconsistentGroupProtocol KError = 23 // Errors.INCONSISTENT_GROUP_PROTOCOL
  158. ErrInvalidGroupId KError = 24 // Errors.INVALID_GROUP_ID
  159. ErrUnknownMemberId KError = 25 // Errors.UNKNOWN_MEMBER_ID
  160. ErrInvalidSessionTimeout KError = 26 // Errors.INVALID_SESSION_TIMEOUT
  161. ErrRebalanceInProgress KError = 27 // Errors.REBALANCE_IN_PROGRESS
  162. ErrInvalidCommitOffsetSize KError = 28 // Errors.INVALID_COMMIT_OFFSET_SIZE
  163. ErrTopicAuthorizationFailed KError = 29 // Errors.TOPIC_AUTHORIZATION_FAILED
  164. ErrGroupAuthorizationFailed KError = 30 // Errors.GROUP_AUTHORIZATION_FAILED
  165. ErrClusterAuthorizationFailed KError = 31 // Errors.CLUSTER_AUTHORIZATION_FAILED
  166. ErrInvalidTimestamp KError = 32 // Errors.INVALID_TIMESTAMP
  167. ErrUnsupportedSASLMechanism KError = 33 // Errors.UNSUPPORTED_SASL_MECHANISM
  168. ErrIllegalSASLState KError = 34 // Errors.ILLEGAL_SASL_STATE
  169. ErrUnsupportedVersion KError = 35 // Errors.UNSUPPORTED_VERSION
  170. ErrTopicAlreadyExists KError = 36 // Errors.TOPIC_ALREADY_EXISTS
  171. ErrInvalidPartitions KError = 37 // Errors.INVALID_PARTITIONS
  172. ErrInvalidReplicationFactor KError = 38 // Errors.INVALID_REPLICATION_FACTOR
  173. ErrInvalidReplicaAssignment KError = 39 // Errors.INVALID_REPLICA_ASSIGNMENT
  174. ErrInvalidConfig KError = 40 // Errors.INVALID_CONFIG
  175. ErrNotController KError = 41 // Errors.NOT_CONTROLLER
  176. ErrInvalidRequest KError = 42 // Errors.INVALID_REQUEST
  177. ErrUnsupportedForMessageFormat KError = 43 // Errors.UNSUPPORTED_FOR_MESSAGE_FORMAT
  178. ErrPolicyViolation KError = 44 // Errors.POLICY_VIOLATION
  179. ErrOutOfOrderSequenceNumber KError = 45 // Errors.OUT_OF_ORDER_SEQUENCE_NUMBER
  180. ErrDuplicateSequenceNumber KError = 46 // Errors.DUPLICATE_SEQUENCE_NUMBER
  181. ErrInvalidProducerEpoch KError = 47 // Errors.INVALID_PRODUCER_EPOCH
  182. ErrInvalidTxnState KError = 48 // Errors.INVALID_TXN_STATE
  183. ErrInvalidProducerIDMapping KError = 49 // Errors.INVALID_PRODUCER_ID_MAPPING
  184. ErrInvalidTransactionTimeout KError = 50 // Errors.INVALID_TRANSACTION_TIMEOUT
  185. ErrConcurrentTransactions KError = 51 // Errors.CONCURRENT_TRANSACTIONS
  186. ErrTransactionCoordinatorFenced KError = 52 // Errors.TRANSACTION_COORDINATOR_FENCED
  187. ErrTransactionalIDAuthorizationFailed KError = 53 // Errors.TRANSACTIONAL_ID_AUTHORIZATION_FAILED
  188. ErrSecurityDisabled KError = 54 // Errors.SECURITY_DISABLED
  189. ErrOperationNotAttempted KError = 55 // Errors.OPERATION_NOT_ATTEMPTED
  190. ErrKafkaStorageError KError = 56 // Errors.KAFKA_STORAGE_ERROR
  191. ErrLogDirNotFound KError = 57 // Errors.LOG_DIR_NOT_FOUND
  192. ErrSASLAuthenticationFailed KError = 58 // Errors.SASL_AUTHENTICATION_FAILED
  193. ErrUnknownProducerID KError = 59 // Errors.UNKNOWN_PRODUCER_ID
  194. ErrReassignmentInProgress KError = 60 // Errors.REASSIGNMENT_IN_PROGRESS
  195. ErrDelegationTokenAuthDisabled KError = 61 // Errors.DELEGATION_TOKEN_AUTH_DISABLED
  196. ErrDelegationTokenNotFound KError = 62 // Errors.DELEGATION_TOKEN_NOT_FOUND
  197. ErrDelegationTokenOwnerMismatch KError = 63 // Errors.DELEGATION_TOKEN_OWNER_MISMATCH
  198. ErrDelegationTokenRequestNotAllowed KError = 64 // Errors.DELEGATION_TOKEN_REQUEST_NOT_ALLOWED
  199. ErrDelegationTokenAuthorizationFailed KError = 65 // Errors.DELEGATION_TOKEN_AUTHORIZATION_FAILED
  200. ErrDelegationTokenExpired KError = 66 // Errors.DELEGATION_TOKEN_EXPIRED
  201. ErrInvalidPrincipalType KError = 67 // Errors.INVALID_PRINCIPAL_TYPE
  202. ErrNonEmptyGroup KError = 68 // Errors.NON_EMPTY_GROUP
  203. ErrGroupIDNotFound KError = 69 // Errors.GROUP_ID_NOT_FOUND
  204. ErrFetchSessionIDNotFound KError = 70 // Errors.FETCH_SESSION_ID_NOT_FOUND
  205. ErrInvalidFetchSessionEpoch KError = 71 // Errors.INVALID_FETCH_SESSION_EPOCH
  206. ErrListenerNotFound KError = 72 // Errors.LISTENER_NOT_FOUND
  207. ErrTopicDeletionDisabled KError = 73 // Errors.TOPIC_DELETION_DISABLED
  208. ErrFencedLeaderEpoch KError = 74 // Errors.FENCED_LEADER_EPOCH
  209. ErrUnknownLeaderEpoch KError = 75 // Errors.UNKNOWN_LEADER_EPOCH
  210. ErrUnsupportedCompressionType KError = 76 // Errors.UNSUPPORTED_COMPRESSION_TYPE
  211. ErrStaleBrokerEpoch KError = 77 // Errors.STALE_BROKER_EPOCH
  212. ErrOffsetNotAvailable KError = 78 // Errors.OFFSET_NOT_AVAILABLE
  213. ErrMemberIdRequired KError = 79 // Errors.MEMBER_ID_REQUIRED
  214. ErrPreferredLeaderNotAvailable KError = 80 // Errors.PREFERRED_LEADER_NOT_AVAILABLE
  215. ErrGroupMaxSizeReached KError = 81 // Errors.GROUP_MAX_SIZE_REACHED
  216. ErrFencedInstancedId KError = 82 // Errors.FENCED_INSTANCE_ID
  217. ErrEligibleLeadersNotAvailable KError = 83 // Errors.ELIGIBLE_LEADERS_NOT_AVAILABLE
  218. ErrElectionNotNeeded KError = 84 // Errors.ELECTION_NOT_NEEDED
  219. ErrNoReassignmentInProgress KError = 85 // Errors.NO_REASSIGNMENT_IN_PROGRESS
  220. ErrGroupSubscribedToTopic KError = 86 // Errors.GROUP_SUBSCRIBED_TO_TOPIC
  221. ErrInvalidRecord KError = 87 // Errors.INVALID_RECORD
  222. ErrUnstableOffsetCommit KError = 88 // Errors.UNSTABLE_OFFSET_COMMIT
  223. ErrThrottlingQuotaExceeded KError = 89 // Errors.THROTTLING_QUOTA_EXCEEDED
  224. ErrProducerFenced KError = 90 // Errors.PRODUCER_FENCED
  225. )
  226. func (err KError) Error() string {
  227. // Error messages stolen/adapted from
  228. // https://kafka.apache.org/protocol#protocol_error_codes
  229. switch err {
  230. case ErrNoError:
  231. return "kafka server: Not an error, why are you printing me?"
  232. case ErrUnknown:
  233. return "kafka server: Unexpected (unknown?) server error"
  234. case ErrOffsetOutOfRange:
  235. return "kafka server: The requested offset is outside the range of offsets maintained by the server for the given topic/partition"
  236. case ErrInvalidMessage:
  237. return "kafka server: Message contents does not match its CRC"
  238. case ErrUnknownTopicOrPartition:
  239. return "kafka server: Request was for a topic or partition that does not exist on this broker"
  240. case ErrInvalidMessageSize:
  241. return "kafka server: The message has a negative size"
  242. case ErrLeaderNotAvailable:
  243. return "kafka server: In the middle of a leadership election, there is currently no leader for this partition and hence it is unavailable for writes"
  244. case ErrNotLeaderForPartition:
  245. return "kafka server: Tried to send a message to a replica that is not the leader for some partition. Your metadata is out of date"
  246. case ErrRequestTimedOut:
  247. return "kafka server: Request exceeded the user-specified time limit in the request"
  248. case ErrBrokerNotAvailable:
  249. return "kafka server: Broker not available. Not a client facing error, we should never receive this!!!"
  250. case ErrReplicaNotAvailable:
  251. return "kafka server: Replica information not available, one or more brokers are down"
  252. case ErrMessageSizeTooLarge:
  253. return "kafka server: Message was too large, server rejected it to avoid allocation error"
  254. case ErrStaleControllerEpochCode:
  255. return "kafka server: StaleControllerEpochCode (internal error code for broker-to-broker communication)"
  256. case ErrOffsetMetadataTooLarge:
  257. return "kafka server: Specified a string larger than the configured maximum for offset metadata"
  258. case ErrNetworkException:
  259. return "kafka server: The server disconnected before a response was received"
  260. case ErrOffsetsLoadInProgress:
  261. return "kafka server: The coordinator is still loading offsets and cannot currently process requests"
  262. case ErrConsumerCoordinatorNotAvailable:
  263. return "kafka server: Offset's topic has not yet been created"
  264. case ErrNotCoordinatorForConsumer:
  265. return "kafka server: Request was for a consumer group that is not coordinated by this broker"
  266. case ErrInvalidTopic:
  267. return "kafka server: The request attempted to perform an operation on an invalid topic"
  268. case ErrMessageSetSizeTooLarge:
  269. return "kafka server: The request included message batch larger than the configured segment size on the server"
  270. case ErrNotEnoughReplicas:
  271. return "kafka server: Messages are rejected since there are fewer in-sync replicas than required"
  272. case ErrNotEnoughReplicasAfterAppend:
  273. return "kafka server: Messages are written to the log, but to fewer in-sync replicas than required"
  274. case ErrInvalidRequiredAcks:
  275. return "kafka server: The number of required acks is invalid (should be either -1, 0, or 1)"
  276. case ErrIllegalGeneration:
  277. return "kafka server: The provided generation id is not the current generation"
  278. case ErrInconsistentGroupProtocol:
  279. return "kafka server: The provider group protocol type is incompatible with the other members"
  280. case ErrInvalidGroupId:
  281. return "kafka server: The provided group id was empty"
  282. case ErrUnknownMemberId:
  283. return "kafka server: The provided member is not known in the current generation"
  284. case ErrInvalidSessionTimeout:
  285. return "kafka server: The provided session timeout is outside the allowed range"
  286. case ErrRebalanceInProgress:
  287. return "kafka server: A rebalance for the group is in progress. Please re-join the group"
  288. case ErrInvalidCommitOffsetSize:
  289. return "kafka server: The provided commit metadata was too large"
  290. case ErrTopicAuthorizationFailed:
  291. return "kafka server: The client is not authorized to access this topic"
  292. case ErrGroupAuthorizationFailed:
  293. return "kafka server: The client is not authorized to access this group"
  294. case ErrClusterAuthorizationFailed:
  295. return "kafka server: The client is not authorized to send this request type"
  296. case ErrInvalidTimestamp:
  297. return "kafka server: The timestamp of the message is out of acceptable range"
  298. case ErrUnsupportedSASLMechanism:
  299. return "kafka server: The broker does not support the requested SASL mechanism"
  300. case ErrIllegalSASLState:
  301. return "kafka server: Request is not valid given the current SASL state"
  302. case ErrUnsupportedVersion:
  303. return "kafka server: The version of API is not supported"
  304. case ErrTopicAlreadyExists:
  305. return "kafka server: Topic with this name already exists"
  306. case ErrInvalidPartitions:
  307. return "kafka server: Number of partitions is invalid"
  308. case ErrInvalidReplicationFactor:
  309. return "kafka server: Replication-factor is invalid"
  310. case ErrInvalidReplicaAssignment:
  311. return "kafka server: Replica assignment is invalid"
  312. case ErrInvalidConfig:
  313. return "kafka server: Configuration is invalid"
  314. case ErrNotController:
  315. return "kafka server: This is not the correct controller for this cluster"
  316. case ErrInvalidRequest:
  317. return "kafka server: This 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"
  318. case ErrUnsupportedForMessageFormat:
  319. return "kafka server: The requested operation is not supported by the message format version"
  320. case ErrPolicyViolation:
  321. return "kafka server: Request parameters do not satisfy the configured policy"
  322. case ErrOutOfOrderSequenceNumber:
  323. return "kafka server: The broker received an out of order sequence number"
  324. case ErrDuplicateSequenceNumber:
  325. return "kafka server: The broker received a duplicate sequence number"
  326. case ErrInvalidProducerEpoch:
  327. return "kafka server: Producer attempted an operation with an old epoch"
  328. case ErrInvalidTxnState:
  329. return "kafka server: The producer attempted a transactional operation in an invalid state"
  330. case ErrInvalidProducerIDMapping:
  331. return "kafka server: The producer attempted to use a producer id which is not currently assigned to its transactional id"
  332. case ErrInvalidTransactionTimeout:
  333. return "kafka server: The transaction timeout is larger than the maximum value allowed by the broker (as configured by max.transaction.timeout.ms)"
  334. case ErrConcurrentTransactions:
  335. return "kafka server: The producer attempted to update a transaction while another concurrent operation on the same transaction was ongoing"
  336. case ErrTransactionCoordinatorFenced:
  337. return "kafka server: The transaction coordinator sending a WriteTxnMarker is no longer the current coordinator for a given producer"
  338. case ErrTransactionalIDAuthorizationFailed:
  339. return "kafka server: Transactional ID authorization failed"
  340. case ErrSecurityDisabled:
  341. return "kafka server: Security features are disabled"
  342. case ErrOperationNotAttempted:
  343. return "kafka server: The broker did not attempt to execute this operation"
  344. case ErrKafkaStorageError:
  345. return "kafka server: Disk error when trying to access log file on the disk"
  346. case ErrLogDirNotFound:
  347. return "kafka server: The specified log directory is not found in the broker config"
  348. case ErrSASLAuthenticationFailed:
  349. return "kafka server: SASL Authentication failed"
  350. case ErrUnknownProducerID:
  351. return "kafka server: The broker could not locate the producer metadata associated with the Producer ID"
  352. case ErrReassignmentInProgress:
  353. return "kafka server: A partition reassignment is in progress"
  354. case ErrDelegationTokenAuthDisabled:
  355. return "kafka server: Delegation Token feature is not enabled"
  356. case ErrDelegationTokenNotFound:
  357. return "kafka server: Delegation Token is not found on server"
  358. case ErrDelegationTokenOwnerMismatch:
  359. return "kafka server: Specified Principal is not valid Owner/Renewer"
  360. case ErrDelegationTokenRequestNotAllowed:
  361. return "kafka server: Delegation Token requests are not allowed on PLAINTEXT/1-way SSL channels and on delegation token authenticated channels"
  362. case ErrDelegationTokenAuthorizationFailed:
  363. return "kafka server: Delegation Token authorization failed"
  364. case ErrDelegationTokenExpired:
  365. return "kafka server: Delegation Token is expired"
  366. case ErrInvalidPrincipalType:
  367. return "kafka server: Supplied principalType is not supported"
  368. case ErrNonEmptyGroup:
  369. return "kafka server: The group is not empty"
  370. case ErrGroupIDNotFound:
  371. return "kafka server: The group id does not exist"
  372. case ErrFetchSessionIDNotFound:
  373. return "kafka server: The fetch session ID was not found"
  374. case ErrInvalidFetchSessionEpoch:
  375. return "kafka server: The fetch session epoch is invalid"
  376. case ErrListenerNotFound:
  377. return "kafka server: There is no listener on the leader broker that matches the listener on which metadata request was processed"
  378. case ErrTopicDeletionDisabled:
  379. return "kafka server: Topic deletion is disabled"
  380. case ErrFencedLeaderEpoch:
  381. return "kafka server: The leader epoch in the request is older than the epoch on the broker"
  382. case ErrUnknownLeaderEpoch:
  383. return "kafka server: The leader epoch in the request is newer than the epoch on the broker"
  384. case ErrUnsupportedCompressionType:
  385. return "kafka server: The requesting client does not support the compression type of given partition"
  386. case ErrStaleBrokerEpoch:
  387. return "kafka server: Broker epoch has changed"
  388. case ErrOffsetNotAvailable:
  389. return "kafka server: The leader high watermark has not caught up from a recent leader election so the offsets cannot be guaranteed to be monotonically increasing"
  390. case ErrMemberIdRequired:
  391. return "kafka server: The group member needs to have a valid member id before actually entering a consumer group"
  392. case ErrPreferredLeaderNotAvailable:
  393. return "kafka server: The preferred leader was not available"
  394. case ErrGroupMaxSizeReached:
  395. return "kafka server: Consumer group The consumer group has reached its max size. already has the configured maximum number of members"
  396. case ErrFencedInstancedId:
  397. return "kafka server: The broker rejected this static consumer since another consumer with the same group.instance.id has registered with a different member.id"
  398. case ErrEligibleLeadersNotAvailable:
  399. return "kafka server: Eligible topic partition leaders are not available"
  400. case ErrElectionNotNeeded:
  401. return "kafka server: Leader election not needed for topic partition"
  402. case ErrNoReassignmentInProgress:
  403. return "kafka server: No partition reassignment is in progress"
  404. case ErrGroupSubscribedToTopic:
  405. return "kafka server: Deleting offsets of a topic is forbidden while the consumer group is actively subscribed to it"
  406. case ErrInvalidRecord:
  407. return "kafka server: This record has failed the validation on broker and hence will be rejected"
  408. case ErrUnstableOffsetCommit:
  409. return "kafka server: There are unstable offsets that need to be cleared"
  410. }
  411. return fmt.Sprintf("Unknown error, how did this happen? Error code = %d", err)
  412. }