Skip to main content

ErrorCode

Enum ErrorCode 

Source
pub enum ErrorCode {
Show 135 variants UnknownServerError, OffsetOutOfRange, CorruptMessage, UnknownTopicOrPartition, InvalidFetchSize, LeaderNotAvailable, NotLeaderOrFollower, RequestTimedOut, BrokerNotAvailable, ReplicaNotAvailable, MessageTooLarge, StaleControllerEpoch, OffsetMetadataTooLarge, NetworkException, CoordinatorLoadInProgress, CoordinatorNotAvailable, NotCoordinator, InvalidTopicException, RecordListTooLarge, NotEnoughReplicas, NotEnoughReplicasAfterAppend, InvalidRequiredAcks, IllegalGeneration, InconsistentGroupProtocol, InvalidGroupId, UnknownMemberId, InvalidSessionTimeout, RebalanceInProgress, InvalidCommitOffsetSize, TopicAuthorizationFailed, GroupAuthorizationFailed, ClusterAuthorizationFailed, InvalidTimestamp, UnsupportedSaslMechanism, IllegalSaslState, UnsupportedVersion, TopicAlreadyExists, InvalidPartitions, InvalidReplicationFactor, InvalidReplicaAssignment, InvalidConfig, NotController, InvalidRequest, UnsupportedForMessageFormat, PolicyViolation, OutOfOrderSequenceNumber, DuplicateSequenceNumber, InvalidProducerEpoch, InvalidTxnState, InvalidProducerIdMapping, InvalidTransactionTimeout, ConcurrentTransactions, TransactionCoordinatorFenced, TransactionalIdAuthorizationFailed, SecurityDisabled, OperationNotAttempted, KafkaStorageError, LogDirNotFound, SaslAuthenticationFailed, UnknownProducerId, ReassignmentInProgress, DelegationTokenAuthDisabled, DelegationTokenNotFound, DelegationTokenOwnerMismatch, DelegationTokenRequestNotAllowed, DelegationTokenAuthorizationFailed, DelegationTokenExpired, InvalidPrincipalType, NonEmptyGroup, GroupIdNotFound, FetchSessionIdNotFound, InvalidFetchSessionEpoch, ListenerNotFound, TopicDeletionDisabled, FencedLeaderEpoch, UnknownLeaderEpoch, UnsupportedCompressionType, StaleBrokerEpoch, OffsetNotAvailable, MemberIdRequired, PreferredLeaderNotAvailable, GroupMaxSizeReached, FencedInstanceId, EligibleLeadersNotAvailable, ElectionNotNeeded, NoReassignmentInProgress, GroupSubscribedToTopic, InvalidRecord, UnstableOffsetCommit, ThrottlingQuotaExceeded, ProducerFenced, ResourceNotFound, DuplicateResource, UnacceptableCredential, InconsistentVoterSet, InvalidUpdateVersion, FeatureUpdateFailed, PrincipalDeserializationFailure, SnapshotNotFound, PositionOutOfRange, UnknownTopicId, DuplicateBrokerRegistration, BrokerIdNotRegistered, InconsistentTopicId, InconsistentClusterId, TransactionalIdNotFound, FetchSessionTopicIdError, IneligibleReplica, NewLeaderElected, OffsetMovedToTieredStorage, FencedMemberEpoch, UnreleasedInstanceId, UnsupportedAssignor, StaleMemberEpoch, MismatchedEndpointType, UnsupportedEndpointType, UnknownControllerId, UnknownSubscriptionId, TelemetryTooLarge, InvalidRegistration, TransactionAbortable, InvalidRecordState, ShareSessionNotFound, InvalidShareSessionEpoch, FencedStateEpoch, InvalidVoterKey, DuplicateVoter, VoterNotFound, InvalidRegularExpression, RebootstrapRequired, StreamsInvalidTopology, StreamsInvalidTopologyEpoch, StreamsTopologyFenced, ShareSessionLimitReached, Unknown(i16),
}
Expand description

The error taxonomy, re-exported.

One type across the workspace: see the crate docs for why it is defined a layer down. A Kafka broker error code.

Variants§

§

UnknownServerError

The server experienced an unexpected error when processing the request.

§

OffsetOutOfRange

The requested offset is not within the range of offsets maintained by the server.

§

CorruptMessage

This message has failed its CRC checksum, exceeds the valid size, has a null key for a compacted topic, or is otherwise corrupt.

§

UnknownTopicOrPartition

This server does not host this topic-partition.

§

InvalidFetchSize

The requested fetch size is invalid.

§

LeaderNotAvailable

There is no leader for this topic-partition as we are in the middle of a leadership election.

§

NotLeaderOrFollower

For requests intended only for the leader, this error indicates that the broker is not the current leader. For requests intended for any replica, this error indicates that the broker is not a replica of the topic partition.

§

RequestTimedOut

The request timed out.

§

BrokerNotAvailable

The broker is not available.

§

ReplicaNotAvailable

The replica is not available for the requested topic-partition. Produce/Fetch requests and other requests intended only for the leader or follower return NOT_LEADER_OR_FOLLOWER if the broker is not a replica of the topic-partition.

§

MessageTooLarge

The request included a message larger than the max message size the server will accept.

§

StaleControllerEpoch

The controller moved to another broker.

§

OffsetMetadataTooLarge

The metadata field of the offset request was too large.

§

NetworkException

The server disconnected before a response was received.

§

CoordinatorLoadInProgress

The coordinator is loading and hence can’t process requests.

§

CoordinatorNotAvailable

The coordinator is not available.

§

NotCoordinator

This is not the correct coordinator.

§

InvalidTopicException

The request attempted to perform an operation on an invalid topic.

§

RecordListTooLarge

The request included message batch larger than the configured segment size on the server.

§

NotEnoughReplicas

Messages are rejected since there are fewer in-sync replicas than required.

§

NotEnoughReplicasAfterAppend

Messages are written to the log, but to fewer in-sync replicas than required.

§

InvalidRequiredAcks

Produce request specified an invalid value for required acks.

§

IllegalGeneration

Specified group generation id is not valid.

§

InconsistentGroupProtocol

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.

§

InvalidGroupId

The configured groupId is invalid.

§

UnknownMemberId

The coordinator is not aware of this member.

§

InvalidSessionTimeout

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).

§

RebalanceInProgress

The group is rebalancing, so a rejoin is needed.

§

InvalidCommitOffsetSize

The committing offset data size is not valid.

§

TopicAuthorizationFailed

Topic authorization failed.

§

GroupAuthorizationFailed

Group authorization failed.

§

ClusterAuthorizationFailed

Cluster authorization failed.

§

InvalidTimestamp

The timestamp of the message is out of acceptable range.

§

UnsupportedSaslMechanism

The broker does not support the requested SASL mechanism.

§

IllegalSaslState

Request is not valid given the current SASL state.

§

UnsupportedVersion

The version of API is not supported.

§

TopicAlreadyExists

Topic with this name already exists.

§

InvalidPartitions

Number of partitions is below 1.

§

InvalidReplicationFactor

Replication factor is below 1 or larger than the number of available brokers.

§

InvalidReplicaAssignment

Replica assignment is invalid.

§

InvalidConfig

Configuration is invalid.

§

NotController

This is not the correct controller for this cluster.

§

InvalidRequest

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.

§

UnsupportedForMessageFormat

The message format version on the broker does not support the request.

§

PolicyViolation

Request parameters do not satisfy the configured policy.

§

OutOfOrderSequenceNumber

The broker received an out of order sequence number.

§

DuplicateSequenceNumber

The broker received a duplicate sequence number.

§

InvalidProducerEpoch

Producer attempted to produce with an old epoch.

§

InvalidTxnState

The producer attempted a transactional operation in an invalid state.

§

InvalidProducerIdMapping

The producer attempted to use a producer id which is not currently assigned to its transactional id.

§

InvalidTransactionTimeout

The transaction timeout is larger than the maximum value allowed by the broker (as configured by transaction.max.timeout.ms).

§

ConcurrentTransactions

The producer attempted to update a transaction while another concurrent operation on the same transaction was ongoing.

§

TransactionCoordinatorFenced

Indicates that the transaction coordinator sending a WriteTxnMarker is no longer the current coordinator for a given producer.

§

TransactionalIdAuthorizationFailed

Transactional Id authorization failed.

§

SecurityDisabled

Security features are disabled.

§

OperationNotAttempted

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.

§

KafkaStorageError

Disk error when trying to access log file on the disk.

§

LogDirNotFound

The user-specified log directory is not found in the broker config.

§

SaslAuthenticationFailed

SASL Authentication failed.

§

UnknownProducerId

This exception 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 exception.

§

ReassignmentInProgress

A partition reassignment is in progress.

§

DelegationTokenAuthDisabled

Delegation Token feature is not enabled.

§

DelegationTokenNotFound

Delegation Token is not found on server.

§

DelegationTokenOwnerMismatch

Specified Principal is not valid Owner/Renewer.

§

DelegationTokenRequestNotAllowed

Delegation Token requests are not allowed on PLAINTEXT/1-way SSL channels and on delegation token authenticated channels.

§

DelegationTokenAuthorizationFailed

Delegation Token authorization failed.

§

DelegationTokenExpired

Delegation Token is expired.

§

InvalidPrincipalType

Supplied principalType is not supported.

§

NonEmptyGroup

The group is not empty.

§

GroupIdNotFound

The group id does not exist.

§

FetchSessionIdNotFound

The fetch session ID was not found.

§

InvalidFetchSessionEpoch

The fetch session epoch is invalid.

§

ListenerNotFound

There is no listener on the leader broker that matches the listener on which metadata request was processed.

§

TopicDeletionDisabled

Topic deletion is disabled.

§

FencedLeaderEpoch

The leader epoch in the request is older than the epoch on the broker.

§

UnknownLeaderEpoch

The leader epoch in the request is newer than the epoch on the broker.

§

UnsupportedCompressionType

The requesting client does not support the compression type of given partition.

§

StaleBrokerEpoch

Broker epoch has changed.

§

OffsetNotAvailable

The leader high watermark has not caught up from a recent leader election so the offsets cannot be guaranteed to be monotonically increasing.

§

MemberIdRequired

The group member needs to have a valid member id before actually entering a consumer group.

§

PreferredLeaderNotAvailable

The preferred leader was not available.

§

GroupMaxSizeReached

The consumer group has reached its max size.

§

FencedInstanceId

The broker rejected this static consumer since another consumer with the same group.instance.id has registered with a different member.id.

§

EligibleLeadersNotAvailable

Eligible topic partition leaders are not available.

§

ElectionNotNeeded

Leader election not needed for topic partition.

§

NoReassignmentInProgress

No partition reassignment is in progress.

§

GroupSubscribedToTopic

Deleting offsets of a topic is forbidden while the consumer group is actively subscribed to it.

§

InvalidRecord

This record has failed the validation on broker and hence will be rejected.

§

UnstableOffsetCommit

There are unstable offsets that need to be cleared.

§

ThrottlingQuotaExceeded

The throttling quota has been exceeded.

§

ProducerFenced

There is a newer producer with the same transactionalId which fences the current one.

§

ResourceNotFound

A request illegally referred to a resource that does not exist.

§

DuplicateResource

A request illegally referred to the same resource twice.

§

UnacceptableCredential

Requested credential would not meet criteria for acceptability.

§

InconsistentVoterSet

Indicates that the either the sender or recipient of a voter-only request is not one of the expected voters

§

InvalidUpdateVersion

The given update version was invalid.

§

FeatureUpdateFailed

Unable to update finalized features due to an unexpected server error.

§

PrincipalDeserializationFailure

Request principal deserialization failed during forwarding. This indicates an internal error on the broker cluster security setup.

§

SnapshotNotFound

Requested snapshot was not found

§

PositionOutOfRange

Requested position is not greater than or equal to zero, and less than the size of the snapshot.

§

UnknownTopicId

This server does not host this topic ID.

§

DuplicateBrokerRegistration

This broker ID is already in use.

§

BrokerIdNotRegistered

The given broker ID was not registered.

§

InconsistentTopicId

The log’s topic ID did not match the topic ID in the request

§

InconsistentClusterId

The clusterId in the request does not match that found on the server

§

TransactionalIdNotFound

The transactionalId could not be found

§

FetchSessionTopicIdError

The fetch session encountered inconsistent topic ID usage

§

IneligibleReplica

The new ISR contains at least one ineligible replica.

§

NewLeaderElected

The AlterPartition request successfully updated the partition state but the leader has changed.

§

OffsetMovedToTieredStorage

The requested offset is moved to tiered storage.

§

FencedMemberEpoch

The member epoch is fenced by the group coordinator. The member must abandon all its partitions and rejoin.

§

UnreleasedInstanceId

The instance ID is still used by another member in the consumer group. That member must leave first.

§

UnsupportedAssignor

The assignor or its version range is not supported by the consumer group.

§

StaleMemberEpoch

The member epoch is stale. The member must retry after receiving its updated member epoch via the ConsumerGroupHeartbeat API.

§

MismatchedEndpointType

The request was sent to an endpoint of the wrong type.

§

UnsupportedEndpointType

This endpoint type is not supported yet.

§

UnknownControllerId

This controller ID is not known.

§

UnknownSubscriptionId

Client sent a push telemetry request with an invalid or outdated subscription ID.

§

TelemetryTooLarge

Client sent a push telemetry request larger than the maximum size the broker will accept.

§

InvalidRegistration

The controller has considered the broker registration to be invalid.

§

TransactionAbortable

The server encountered an error with the transaction. The client can abort the transaction to continue using this transactional ID.

§

InvalidRecordState

The record state is invalid. The acknowledgement of delivery could not be completed.

§

ShareSessionNotFound

The share session was not found.

§

InvalidShareSessionEpoch

The share session epoch is invalid.

§

FencedStateEpoch

The share coordinator rejected the request because the share-group state epoch did not match.

§

InvalidVoterKey

The voter key doesn’t match the receiving replica’s key.

§

DuplicateVoter

The voter is already part of the set of voters.

§

VoterNotFound

The voter is not part of the set of voters.

§

InvalidRegularExpression

The regular expression is not valid.

§

RebootstrapRequired

Client metadata is stale, client should rebootstrap to obtain new metadata.

§

StreamsInvalidTopology

The supplied topology is invalid.

§

StreamsInvalidTopologyEpoch

The supplied topology epoch is invalid.

§

StreamsTopologyFenced

The supplied topology epoch is outdated.

§

ShareSessionLimitReached

The limit of share sessions has been reached.

§

Unknown(i16)

A code this build has no name for.

Carries the wire value so a UI can still show it and a bug report can still identify it.

Implementations§

Source§

impl ErrorCode

Source

pub const fn code(self) -> i16

The wire code.

Source

pub const fn name(self) -> Option<&'static str>

The code’s protocol name, or None for an unrecognised code.

Source

pub const fn description(self) -> Option<&'static str>

The protocol’s own description of the code.

Source

pub fn from_code(code: i16) -> Option<ErrorCode>

Classify a wire code.

0 means success and has no ErrorCode; callers get None and should treat the response as good.

Source

pub fn retriable(self) -> bool

Whether the protocol considers this code worth retrying.

Delegated to the crate rather than re-stated here. Unknown is not retriable, matching what every other Kafka client does with a code it cannot interpret.

Source

pub fn retriable_for_named_resource(self) -> bool

Whether retrying is worthwhile when the request named a specific resource that the broker says does not exist.

This exists because PLAN.md’s M5 acceptance and the protocol disagree, and both are right about different things. Kafka calls UNKNOWN_TOPIC_OR_PARTITION retriable, and for a topic that is mid-creation or mid-propagation it genuinely is. For a describe of a topic a user typed into a search box it is not: the answer will be the same five times over, and retrying turns a typo into a spinner.

So it is a separate axis rather than a correction to Self::retriable. The protocol’s answer stays the protocol’s answer — derived, not overridden — and callers that named a resource ask this one instead.

Source

pub const fn needs_metadata_refresh(self) -> bool

Whether seeing this code should invalidate the metadata snapshot.

Retrying a NOT_LEADER_OR_FOLLOWER against the same stale leader is an infinite loop that presents as a flaky cluster, so this axis exists separately from retriable.

Source

pub const fn needs_coordinator_refresh(self) -> bool

Whether seeing this code should invalidate a cached coordinator.

Independent of the metadata axis: a group coordinator moving says nothing about partition leadership, and refreshing the wrong cache leaves the retry pointed at the same wrong broker.

Source

pub const fn is_authentication(self) -> bool

Whether this code means the credentials were rejected.

Source

pub const fn is_authorization(self) -> bool

Whether this code means the principal lacked permission.

Trait Implementations§

Source§

impl Clone for ErrorCode

Source§

fn clone(&self) -> ErrorCode

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for ErrorCode

Source§

impl Debug for ErrorCode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Display for ErrorCode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Eq for ErrorCode

Source§

impl Hash for ErrorCode

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for ErrorCode

Source§

fn eq(&self, other: &ErrorCode) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ErrorCode

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more