Skip to main content

Module errors

Module errors 

Source
Expand description

Kafka’s exception classes (org.apache.kafka.common.errors). Kafka’s exception classes.

Translates org.apache.kafka.common.errors. Each Java exception class is one struct in its own file, named with the Exception -> Error substitution of CLAUDE.md §2, and declares its extends chain through its ErrorHierarchy impl rather than through a predicate that enumerates it from the outside.

The error code for each class lives in its ErrorCode impl — Java keeps the same association in Errors’ CLASS_TO_ERROR map — while the default message strings stay in Errors, exactly as Java stores them on the enum constant and passes them to the class’s constructor.

Re-exports§

pub use record_deserialization_error::DeserializationErrorOrigin;
pub use record_deserialization_error::RecordDeserializationError;

Modules§

record_deserialization_error
Translated from org.apache.kafka.common.errors.RecordDeserializationException.

Structs§

ApiError
Any API error that is part of the public protocol and should be a subclass of this class and be part of this package.
AuthenticationError
This error indicates that SASL authentication has failed. On authentication failure, clients abort the operation requested and raise one of the subclasses of this error:
AuthorizationError
The client is not authorized to perform the operation.
AuthorizerNotReadyError
An error that indicates that the authorizer is not ready to receive the request yet.
BootstrapResolutionError
Indicates that the NetworkClient was unable to resolve a DNS address within the time specified by CommonClientConfigs::BOOTSTRAP_RESOLVE_TIMEOUT_MS_CONFIG.
BrokerIdNotRegisteredError
The given broker ID was not registered.
BrokerNotAvailableError
The broker is not available.
ClusterAuthorizationError
Cluster authorization failed.
ConcurrentTransactionsError
The producer attempted to update a transaction while another concurrent operation on the same transaction was ongoing.
ControllerIdNotRegisteredError
The given controller ID was not registered.
ControllerMovedError
The controller moved to another broker.
CoordinatorLoadInProgressError
In the context of the group coordinator, the broker returns this error code for any coordinator request if it is still loading the group metadata (e.g. after a leader change for that group metadata topic partition).
CoordinatorNotAvailableError
In the context of the group coordinator, the broker returns this error code for metadata or offset commit requests if the group metadata topic has not been created yet.
CorruptRecordError
This error indicates a record has failed its internal CRC check, this generally indicates network or disk corruption.
DelegationTokenAuthorizationError
Delegation Token authorization failed.
DelegationTokenDisabledError
Delegation Token feature is not enabled.
DelegationTokenExpiredError
Delegation Token is expired.
DelegationTokenNotFoundError
Delegation Token is not found on server.
DelegationTokenOwnerMismatchError
Specified Principal is not valid Owner/Renewer.
DisconnectError
Server disconnected before a request could be completed.
DuplicateBrokerRegistrationError
This broker ID is already in use.
DuplicateResourceError
Error thrown due to a request that illegally refers to the same resource twice (for example, trying to both create and delete the same SCRAM credential for a particular user in a single request).
DuplicateSequenceError
The broker received a duplicate sequence number.
DuplicateVoterError
The voter is already part of the set of voters.
ElectionNotNeededError
Leader election not needed for topic partition.
EligibleLeadersNotAvailableError
Eligible topic partition leaders are not available.
FeatureUpdateFailedError
Unable to update finalized features due to an unexpected server error.
FencedInstanceIdError
The broker rejected this static consumer since another consumer with the same group.instance.id has registered with a different member.id.
FencedLeaderEpochError
The request contained a leader epoch which is smaller than that on the broker that received the request. This can happen when an operation is attempted before a pending metadata update has been received. Clients will typically refresh metadata before retrying.
FencedMemberEpochError
The member epoch is fenced by the group coordinator. The member must abandon all its partitions and rejoin.
FencedStateEpochError
Thrown when the share coordinator rejected the request because the share-group state epoch did not match.
FetchSessionIdNotFoundError
The fetch session ID was not found.
FetchSessionTopicIdError
The fetch session encountered inconsistent topic ID usage.
GroupAuthorizationError
Group authorization failure with the group ID.
GroupDeletionFailedError
Indicates that DeleteGroups could not complete for the affected group. The accompanying error message describes the underlying cause; the caller may retry once the underlying condition is resolved.
GroupIdNotFoundError
The group id does not exist.
GroupMaxSizeReachedError
Indicates that a group is already at its configured maximum capacity and cannot accommodate more members
GroupNotEmptyError
The group is not empty.
GroupSubscribedToTopicError
Deleting offsets of a topic is forbidden while the consumer group is actively subscribed to it.
IllegalGenerationError
Specified group generation id is not valid.
IllegalSaslStateError
This error indicates unexpected requests prior to SASL authentication. This could be due to misconfigured security, e.g. if PLAINTEXT protocol is used to connect to a SASL endpoint.
InconsistentClusterIdError
The clusterId in the request does not match that found on the server.
InconsistentGroupProtocolError
The 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.
InconsistentTopicIdError
The log’s topic ID did not match the topic ID in the request.
InconsistentVoterSetError
Indicates that the either the sender or recipient of a voter-only request is not one of the expected voters.
IneligibleReplicaError
The new ISR contains at least one ineligible replica.
InterruptError
An unchecked wrapper for InterruptedException
InvalidCommitOffsetSizeError
The committing offset data size is not valid.
InvalidConfigurationError
Configuration is invalid.
InvalidFetchSessionEpochError
The fetch session epoch is invalid.
InvalidFetchSizeError
The requested fetch size is invalid.
InvalidGroupIdError
The group id is invalid.
InvalidOffsetError
Thrown when the offset for a set of partitions is invalid (either undefined or out of range), and no reset policy has been configured.
InvalidPartitionsError
Number of partitions is below 1.
InvalidPidMappingError
The producer attempted to use a producer id which is not currently assigned to its transactional id.
InvalidPrincipalTypeError
Supplied principalType is not supported.
InvalidProducerEpochError
This error indicates that the produce request sent to the partition leader contains a non-matching producer epoch. When encountering this error, user should abort the ongoing transaction by calling KafkaProducer::abort_transaction which would try to send initPidRequest and reinitialize the producer under the hood.
InvalidRecordStateError
Thrown when the acknowledgement of delivery of a record could not be completed because the record state is invalid.
InvalidRegistrationError
Thrown when a broker registration request is considered invalid by the controller.
InvalidRegularExpression
Thrown when a regular expression received in a request is not valid.
InvalidReplicaAssignmentError
Replica assignment is invalid.
InvalidReplicationFactorError
Replication factor is below 1 or larger than the number of available brokers.
InvalidRequestError
Thrown when a request breaks basic wire protocol rules. This most likely occurs because of a request being malformed by the client library or the message was sent to an incompatible broker.
InvalidRequiredAcksError
Produce request specified an invalid value for required acks.
InvalidSessionTimeoutError
The 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).
InvalidShareSessionEpochError
Thrown when the share session epoch is invalid.
InvalidTimestampError
Indicate the timestamp of a record is invalid.
InvalidTopicError
The client has attempted to perform an operation on an invalid topic. For example the topic name is too long, contains invalid characters etc. This error is not retriable because the operation won’t suddenly become valid.
InvalidTxnStateError
The producer attempted a transactional operation in an invalid state.
InvalidTxnTimeoutError
The transaction coordinator returns this error code if the timeout received via the InitProducerIdRequest is larger than the transaction.max.timeout.ms config value.
InvalidUpdateVersionError
The given update version was invalid.
InvalidVoterKeyError
The voter key doesn’t match the receiving replica’s key.
KafkaStorageError
Miscellaneous disk-related IOException occurred when handling a request. Client should request metadata update and retry if the response shows KafkaStorageError
LeaderNotAvailableError
There is no currently available leader for the given partition (either because a leadership election is in progress or because all replicas are down).
ListenerNotFoundError
The leader does not have an endpoint corresponding to the listener on which metadata was requested. This could indicate a broker configuration error or a transient error when listeners are updated dynamically and client requests are processed before all brokers have updated their listeners. This is currently used only for missing listeners on leader brokers, but may be used for followers in future.
LogDirNotFoundError
Thrown when a request is made for a log directory that is not present on the broker
MemberIdRequiredError
The group member needs to have a valid member id before actually entering a consumer group.
MismatchedEndpointTypeError
The request was sent to an endpoint of the wrong type.
NetworkError
A misc. network-related IOException occurred when making a request. This could be because the client’s metadata is out of date and it is making a request to a node that is now dead.
NewLeaderElectedError
The AlterPartition request successfully updated the partition state but the leader has changed.
NoReassignmentInProgressError
Thrown if a reassignment cannot be cancelled because none is in progress.
NotControllerError
This is not the correct controller for this cluster.
NotCoordinatorError
In the context of the group coordinator, the broker returns this error code if it receives an offset fetch or commit request for a group it’s not the coordinator of.
NotEnoughReplicasAfterAppendError
Number of insync replicas for the partition is lower than min.insync.replicas This error is raised when the low ISR size is discovered after the message was already appended to the log. Producer retries will cause duplicates.
NotEnoughReplicasError
Number of insync replicas for the partition is lower than min.insync.replicas
NotLeaderOrFollowerError
Broker returns this error if a request could not be processed because the broker is not the leader or follower for a topic partition. This could be a transient error during leader elections and reassignments. For Produce and other requests which are intended only for the leader, this error indicates that the broker is not the current leader. For consumer Fetch requests which may be satisfied by a leader or follower, this error indicates that the broker is not a replica of the topic partition.
OffsetMetadataTooLarge
The client has tried to save its offset with associated metadata larger than the maximum size allowed by the server.
OffsetMovedToTieredStorageError
The requested offset is moved to tiered storage.
OffsetNotAvailableError
Indicates that the leader is not able to guarantee monotonically increasing offsets due to the high watermark lagging behind the epoch start offset after a recent leader election
OffsetOutOfRangeError
No reset policy has been defined, and the offsets for these partitions are either larger or smaller than the range of offsets the server has for the given partition.
OperationNotAttemptedError
Indicates that the 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.
OutOfOrderSequenceError
This error indicates that the broker received an unexpected sequence number from the producer, which means that data may have been lost. If the producer is configured for idempotence only (i.e. if enable.idempotence is set and no transactional.id is configured), it is possible to continue sending with the same producer instance, but doing so risks reordering of sent records. For transactional producers, this is a fatal error and you should close the producer.
PolicyViolationError
Error thrown if a create topics request does not satisfy the configured policy for a topic.
PositionOutOfRangeError
Requested position is not greater than or equal to zero, and less than the size of the snapshot.
PreferredLeaderNotAvailableError
The preferred leader was not available.
PrincipalDeserializationError
Error used to indicate a kafka principal deserialization failure during request forwarding.
ProducerFencedError
This fatal error indicates that another producer with the same transactional.id has been started. It is only possible to have one producer instance with a transactional.id at any given time, and the latest one to be started “fences” the previous instances so that they can no longer make transactional requests. When you encounter this error, you must close the producer instance.
ReassignmentInProgressError
Thrown if a request cannot be completed because a partition reassignment is in progress.
RebalanceInProgressError
The group is rebalancing, so a rejoin is needed.
RebootstrapRequiredError
Client metadata is stale. The client should rebootstrap to obtain new metadata.
RecordBatchTooLargeError
This record batch is larger than the maximum allowable size
RecordTooLargeError
This record is larger than the maximum allowable size
ReplicaNotAvailableError
The replica is not available for the requested topic partition. This may be a transient error during reassignments. From version 2.6 onwards, Fetch requests and other requests intended only for the leader or follower of the topic partition return NotLeaderOrFollowerError if the broker is a not a replica of the partition.
ResourceNotFoundError
Error thrown due to a request for a resource that does not exist.
SaslAuthenticationError
This error indicates that SASL authentication has failed. The error message in the error indicates the actual cause of failure.
SecurityDisabledError
An error indicating that security is disabled on the broker.
SerializationError
Any error during serialization or deserialization.
ShareSessionLimitReachedError
Indicates that a new share session could not be opened because the limit of share sessions has been reached.
ShareSessionNotFoundError
Thrown when the share session was not found.
SnapshotNotFoundError
Requested snapshot was not found.
SslAuthenticationError
This error indicates that SSL handshake has failed. See source() for the SSLException that caused this failure.
StaleBrokerEpochError
Broker epoch has changed.
StaleMemberEpochError
The StaleMemberEpochError is used in the context of the new consumer group protocol (KIP-848). This error is returned in the OffsetCommit/Fetch APIs when the member epoch received does not match the current member epoch.
StreamsInvalidTopologyEpochError
The supplied topology epoch is invalid.
StreamsInvalidTopologyError
The supplied topology is invalid.
StreamsTopologyDescriptionUpdateFailedError
Indicates that the streams group topology description plugin failed to process a StreamsGroupTopologyDescriptionUpdate request. The accompanying error message describes the underlying cause; the broker tracks the transient-vs-permanent distinction internally and does not reflect it on the wire.
StreamsTopologyFencedError
The supplied topology epoch is outdated.
TelemetryTooLargeError
This error indicates that the size of the telemetry metrics data is too large.
ThrottlingQuotaExceededError
Error thrown if an operation on a resource exceeds the throttling quota.
TimeoutError
Indicates that a request timed out.
TopicAuthorizationError
Topic authorization failure with the set of unauthorized topics.
TopicDeletionDisabledError
Topic deletion is disabled.
TopicExistsError
Topic with this name already exists.
TransactionAbortableError
The server encountered an error with the transaction. The client can abort the transaction to continue using this transactional ID.
TransactionAbortedError
This is the error thrown when we are aborting any undrained batches during a transaction which is aborted without any underlying cause - which likely means that the user chose to abort.
TransactionCoordinatorFencedError
Indicates that the transaction coordinator sending a WriteTxnMarker is no longer the current coordinator for a given producer.
TransactionalIdAuthorizationError
Transactional Id authorization failed.
TransactionalIdNotFoundError
The transactionalId could not be found.
UnacceptableCredentialError
Error thrown when attempting to define a credential that does not meet the criteria for acceptability (for example, attempting to create a SCRAM credential with an empty username or password or too few/many iterations).
UnknownControllerIdError
This controller ID is not known.
UnknownLeaderEpochError
The request contained a leader epoch which is larger than that on the broker that received the request. This can happen if the client observes a metadata update before it has been propagated to all brokers. Clients need not refresh metadata before retrying.
UnknownMemberIdError
The coordinator is not aware of this member.
UnknownProducerIdError
This error 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 error.
UnknownServerError
An error occurred on the server for which the client doesn’t have a corresponding error code. This is generally an unexpected error.
UnknownSubscriptionIdError
This error indicates that the client sent an invalid or outdated SubscriptionId
UnknownTopicIdError
This server does not host this topic ID.
UnknownTopicOrPartitionError
This topic/partition doesn’t exist. This error is used in contexts where a topic doesn’t seem to exist based on possibly stale metadata. This error is retriable because the topic or partition might subsequently be created.
UnreleasedInstanceIdError
The instance ID is still used by another member in the consumer group.
UnstableOffsetCommitError
Error thrown when there are unstable offsets for the requested topic partitions.
UnsupportedAssignorError
The assignor or its version range is not supported by the consumer group.
UnsupportedByAuthenticationError
Authentication mechanism does not support the requested function.
UnsupportedCompressionTypeError
The requesting client does not support the compression type of given partition.
UnsupportedEndpointTypeError
This endpoint type is not supported yet.
UnsupportedForMessageFormatError
The message format version does not support the requested function. For example, if idempotence is requested and the topic is using a message format older than 0.11.0.0, then this error will be returned.
UnsupportedSaslMechanismError
This error indicates that the SASL mechanism requested by the client is not enabled on the broker.
UnsupportedVersionError
Indicates that a request API or version needed by the client is not supported by the broker. This is typically a fatal error as Kafka clients will downgrade request versions as needed except in cases where a needed feature is not available in old versions. Fatal errors can generally only be handled by closing the client instance, although in some cases it may be possible to continue without relying on the underlying feature. For example, when the producer is used with idempotence enabled, this error is fatal since the producer does not support reverting to weaker semantics. On the other hand, if this error is raised from KafkaConsumer::offsets_for_times, it would be possible to revert to alternative logic to set the consumer’s position.
VoterNotFoundError
The voter is not part of the set of voters.
WakeupError
Error used to indicate preemption of a blocking operation by an external task. For example, KafkaConsumer::wakeup can be used to break out of an active KafkaConsumer::poll, which would return this error.