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.
- Authentication
Error - 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:
- Authorization
Error - The client is not authorized to perform the operation.
- Authorizer
NotReady Error - An error that indicates that the authorizer is not ready to receive the request yet.
- Bootstrap
Resolution Error - Indicates that the
NetworkClientwas unable to resolve a DNS address within the time specified byCommonClientConfigs::BOOTSTRAP_RESOLVE_TIMEOUT_MS_CONFIG. - Broker
IdNot Registered Error - The given broker ID was not registered.
- Broker
NotAvailable Error - The broker is not available.
- Cluster
Authorization Error - Cluster authorization failed.
- Concurrent
Transactions Error - The producer attempted to update a transaction while another concurrent operation on the same transaction was ongoing.
- Controller
IdNot Registered Error - The given controller ID was not registered.
- Controller
Moved Error - The controller moved to another broker.
- Coordinator
Load InProgress Error - 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).
- Coordinator
NotAvailable Error - 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.
- Corrupt
Record Error - This error indicates a record has failed its internal CRC check, this generally indicates network or disk corruption.
- Delegation
Token Authorization Error - Delegation Token authorization failed.
- Delegation
Token Disabled Error - Delegation Token feature is not enabled.
- Delegation
Token Expired Error - Delegation Token is expired.
- Delegation
Token NotFound Error - Delegation Token is not found on server.
- Delegation
Token Owner Mismatch Error - Specified Principal is not valid Owner/Renewer.
- Disconnect
Error - Server disconnected before a request could be completed.
- Duplicate
Broker Registration Error - This broker ID is already in use.
- Duplicate
Resource Error - 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).
- Duplicate
Sequence Error - The broker received a duplicate sequence number.
- Duplicate
Voter Error - The voter is already part of the set of voters.
- Election
NotNeeded Error - Leader election not needed for topic partition.
- Eligible
Leaders NotAvailable Error - Eligible topic partition leaders are not available.
- Feature
Update Failed Error - Unable to update finalized features due to an unexpected server error.
- Fenced
Instance IdError - The broker rejected this static consumer since another consumer with the same group.instance.id has registered with a different member.id.
- Fenced
Leader Epoch Error - 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.
- Fenced
Member Epoch Error - The member epoch is fenced by the group coordinator. The member must abandon all its partitions and rejoin.
- Fenced
State Epoch Error - Thrown when the share coordinator rejected the request because the share-group state epoch did not match.
- Fetch
Session IdNot Found Error - The fetch session ID was not found.
- Fetch
Session Topic IdError - The fetch session encountered inconsistent topic ID usage.
- Group
Authorization Error - Group authorization failure with the group ID.
- Group
Deletion Failed Error - Indicates that
DeleteGroupscould not complete for the affected group. The accompanying error message describes the underlying cause; the caller may retry once the underlying condition is resolved. - Group
IdNot Found Error - The group id does not exist.
- Group
MaxSize Reached Error - Indicates that a group is already at its configured maximum capacity and cannot accommodate more members
- Group
NotEmpty Error - The group is not empty.
- Group
Subscribed ToTopic Error - Deleting offsets of a topic is forbidden while the consumer group is actively subscribed to it.
- Illegal
Generation Error - Specified group generation id is not valid.
- Illegal
Sasl State Error - 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.
- Inconsistent
Cluster IdError - The clusterId in the request does not match that found on the server.
- Inconsistent
Group Protocol Error - 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.
- Inconsistent
Topic IdError - The log’s topic ID did not match the topic ID in the request.
- Inconsistent
Voter SetError - Indicates that the either the sender or recipient of a voter-only request is not one of the expected voters.
- Ineligible
Replica Error - The new ISR contains at least one ineligible replica.
- Interrupt
Error - An unchecked wrapper for
InterruptedException - Invalid
Commit Offset Size Error - The committing offset data size is not valid.
- Invalid
Configuration Error - Configuration is invalid.
- Invalid
Fetch Session Epoch Error - The fetch session epoch is invalid.
- Invalid
Fetch Size Error - The requested fetch size is invalid.
- Invalid
Group IdError - The group id is invalid.
- Invalid
Offset Error - Thrown when the offset for a set of partitions is invalid (either undefined or out of range), and no reset policy has been configured.
- Invalid
Partitions Error - Number of partitions is below 1.
- Invalid
PidMapping Error - The producer attempted to use a producer id which is not currently assigned to its transactional id.
- Invalid
Principal Type Error - Supplied principalType is not supported.
- Invalid
Producer Epoch Error - 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_transactionwhich would try to send initPidRequest and reinitialize the producer under the hood. - Invalid
Record State Error - Thrown when the acknowledgement of delivery of a record could not be completed because the record state is invalid.
- Invalid
Registration Error - Thrown when a broker registration request is considered invalid by the controller.
- Invalid
Regular Expression - Thrown when a regular expression received in a request is not valid.
- Invalid
Replica Assignment Error - Replica assignment is invalid.
- Invalid
Replication Factor Error - Replication factor is below 1 or larger than the number of available brokers.
- Invalid
Request Error - 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.
- Invalid
Required Acks Error - Produce request specified an invalid value for required acks.
- Invalid
Session Timeout Error - 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).
- Invalid
Share Session Epoch Error - Thrown when the share session epoch is invalid.
- Invalid
Timestamp Error - Indicate the timestamp of a record is invalid.
- Invalid
Topic Error - 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.
- Invalid
TxnState Error - The producer attempted a transactional operation in an invalid state.
- Invalid
TxnTimeout Error - The transaction coordinator returns this error code if the timeout received via the
InitProducerIdRequest is larger than the
transaction.max.timeout.msconfig value. - Invalid
Update Version Error - The given update version was invalid.
- Invalid
Voter KeyError - The voter key doesn’t match the receiving replica’s key.
- Kafka
Storage Error - Miscellaneous disk-related
IOExceptionoccurred when handling a request. Client should request metadata update and retry if the response showsKafkaStorageError - Leader
NotAvailable Error - There is no currently available leader for the given partition (either because a leadership election is in progress or because all replicas are down).
- Listener
NotFound Error - 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.
- LogDir
NotFound Error - Thrown when a request is made for a log directory that is not present on the broker
- Member
IdRequired Error - The group member needs to have a valid member id before actually entering a consumer group.
- Mismatched
Endpoint Type Error - The request was sent to an endpoint of the wrong type.
- Network
Error - A misc. network-related
IOExceptionoccurred 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. - NewLeader
Elected Error - The AlterPartition request successfully updated the partition state but the leader has changed.
- NoReassignment
InProgress Error - Thrown if a reassignment cannot be cancelled because none is in progress.
- NotController
Error - This is not the correct controller for this cluster.
- NotCoordinator
Error - 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.
- NotEnough
Replicas After Append Error - 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.
- NotEnough
Replicas Error - Number of insync replicas for the partition is lower than min.insync.replicas
- NotLeader
OrFollower Error - 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
Produceand other requests which are intended only for the leader, this error indicates that the broker is not the current leader. For consumerFetchrequests which may be satisfied by a leader or follower, this error indicates that the broker is not a replica of the topic partition. - Offset
Metadata TooLarge - The client has tried to save its offset with associated metadata larger than the maximum size allowed by the server.
- Offset
Moved ToTiered Storage Error - The requested offset is moved to tiered storage.
- Offset
NotAvailable Error - 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
- Offset
OutOf Range Error - 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.
- Operation
NotAttempted Error - 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.
- OutOf
Order Sequence Error - 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.idempotenceis set and notransactional.idis 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. - Policy
Violation Error - Error thrown if a create topics request does not satisfy the configured policy for a topic.
- Position
OutOf Range Error - Requested position is not greater than or equal to zero, and less than the size of the snapshot.
- Preferred
Leader NotAvailable Error - The preferred leader was not available.
- Principal
Deserialization Error - Error used to indicate a kafka principal deserialization failure during request forwarding.
- Producer
Fenced Error - This fatal error indicates that another producer with the same
transactional.idhas been started. It is only possible to have one producer instance with atransactional.idat 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. - Reassignment
InProgress Error - Thrown if a request cannot be completed because a partition reassignment is in progress.
- Rebalance
InProgress Error - The group is rebalancing, so a rejoin is needed.
- Rebootstrap
Required Error - Client metadata is stale. The client should rebootstrap to obtain new metadata.
- Record
Batch TooLarge Error - This record batch is larger than the maximum allowable size
- Record
TooLarge Error - This record is larger than the maximum allowable size
- Replica
NotAvailable Error - 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
NotLeaderOrFollowerErrorif the broker is a not a replica of the partition. - Resource
NotFound Error - Error thrown due to a request for a resource that does not exist.
- Sasl
Authentication Error - This error indicates that SASL authentication has failed. The error message in the error indicates the actual cause of failure.
- Security
Disabled Error - An error indicating that security is disabled on the broker.
- Serialization
Error - Any error during serialization or deserialization.
- Share
Session Limit Reached Error - Indicates that a new share session could not be opened because the limit of share sessions has been reached.
- Share
Session NotFound Error - Thrown when the share session was not found.
- Snapshot
NotFound Error - Requested snapshot was not found.
- SslAuthentication
Error - This error indicates that SSL handshake has failed. See
source()for theSSLExceptionthat caused this failure. - Stale
Broker Epoch Error - Broker epoch has changed.
- Stale
Member Epoch Error - 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.
- Streams
Invalid Topology Epoch Error - The supplied topology epoch is invalid.
- Streams
Invalid Topology Error - The supplied topology is invalid.
- Streams
Topology Description Update Failed Error - 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.
- Streams
Topology Fenced Error - The supplied topology epoch is outdated.
- Telemetry
TooLarge Error - This error indicates that the size of the telemetry metrics data is too large.
- Throttling
Quota Exceeded Error - Error thrown if an operation on a resource exceeds the throttling quota.
- Timeout
Error - Indicates that a request timed out.
- Topic
Authorization Error - Topic authorization failure with the set of unauthorized topics.
- Topic
Deletion Disabled Error - Topic deletion is disabled.
- Topic
Exists Error - Topic with this name already exists.
- Transaction
Abortable Error - The server encountered an error with the transaction. The client can abort the transaction to continue using this transactional ID.
- Transaction
Aborted Error - 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.
- Transaction
Coordinator Fenced Error - Indicates that the transaction coordinator sending a WriteTxnMarker is no longer the current coordinator for a given producer.
- Transactional
IdAuthorization Error - Transactional Id authorization failed.
- Transactional
IdNot Found Error - The transactionalId could not be found.
- Unacceptable
Credential Error - 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).
- Unknown
Controller IdError - This controller ID is not known.
- Unknown
Leader Epoch Error - 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.
- Unknown
Member IdError - The coordinator is not aware of this member.
- Unknown
Producer IdError - 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.
- Unknown
Server Error - An error occurred on the server for which the client doesn’t have a corresponding error code. This is generally an unexpected error.
- Unknown
Subscription IdError - This error indicates that the client sent an invalid or outdated SubscriptionId
- Unknown
Topic IdError - This server does not host this topic ID.
- Unknown
Topic OrPartition Error - 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.
- Unreleased
Instance IdError - The instance ID is still used by another member in the consumer group.
- Unstable
Offset Commit Error - Error thrown when there are unstable offsets for the requested topic partitions.
- Unsupported
Assignor Error - The assignor or its version range is not supported by the consumer group.
- Unsupported
ByAuthentication Error - Authentication mechanism does not support the requested function.
- Unsupported
Compression Type Error - The requesting client does not support the compression type of given partition.
- Unsupported
Endpoint Type Error - This endpoint type is not supported yet.
- Unsupported
ForMessage Format Error - 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.
- Unsupported
Sasl Mechanism Error - This error indicates that the SASL mechanism requested by the client is not enabled on the broker.
- Unsupported
Version Error - 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. - Voter
NotFound Error - The voter is not part of the set of voters.
- Wakeup
Error - Error used to indicate preemption of a blocking operation by an external task. For example,
KafkaConsumer::wakeupcan be used to break out of an activeKafkaConsumer::poll, which would return this error.