#[non_exhaustive]pub enum ProtocolErrorKind {
TruncatedFrame,
CrcMismatch,
UnknownApiVersion,
InvalidLength,
InvalidUtf8,
UnsupportedMagic,
InvalidValue,
Malformed,
Other,
}Expand description
Structured classification of KrafkaError::Protocol errors.
The Kafka wire protocol surfaces many distinct failure modes (truncated
frames, CRC mismatches, version negotiation failures, oversized arrays,
etc.) that callers may want to distinguish without substring-matching the
error message. ProtocolErrorKind exposes the classification as a typed
enum while keeping the human-readable detail on the accompanying message.
Kinds are coarse on purpose — they reflect retry/fail decisions rather
than every possible broker-returned condition. Retriability is exposed via
ProtocolErrorKind::is_retriable.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
TruncatedFrame
Buffer exhausted before a complete frame, field, or record could be read.
Usually indicates a short read on the wire or a truncated response body. Retriable: the request may succeed on a fresh connection.
CrcMismatch
Record batch CRC32C did not match the computed checksum.
Indicates on-wire corruption. Retriable.
UnknownApiVersion
No mutually supported API version, or the broker does not advertise the required API at all.
Not retriable — reflects a permanent client/broker version mismatch.
InvalidLength
An encoded length exceeds the protocol maximum (i32::MAX, u32::MAX,
i16::MAX for KafkaString, etc.) or the configured safety cap
(MAX_DECODE_ARRAY_LEN, MAX_RECORD_HEADERS).
Not retriable — indicates a malformed response or a misconfigured cap.
InvalidUtf8
Bytes decoded as a UTF-8 string were not valid UTF-8.
Not retriable.
UnsupportedMagic
Record batch magic byte is not a supported version (only 2 is
accepted today).
Not retriable.
InvalidValue
A field value was outside its allowed range or encoded incorrectly (negative record count, bad enum discriminant, unknown header version, malformed varint, etc.).
Not retriable.
Malformed
The response was structurally malformed in a way that does not fit the other variants (unexpected partition in a response, missing required field, etc.).
Retriable — often transient and resolves after a metadata refresh or reconnection.
Other
Catch-all for protocol errors not otherwise classified.
Not retriable by default; callers should inspect the message.
Implementations§
Source§impl ProtocolErrorKind
impl ProtocolErrorKind
Sourcepub fn is_retriable(self) -> bool
pub fn is_retriable(self) -> bool
Returns true if this protocol error kind is typically transient and safe to retry after a reconnect or metadata refresh.
Trait Implementations§
Source§impl Clone for ProtocolErrorKind
impl Clone for ProtocolErrorKind
Source§fn clone(&self) -> ProtocolErrorKind
fn clone(&self) -> ProtocolErrorKind
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ProtocolErrorKind
impl Debug for ProtocolErrorKind
Source§impl Hash for ProtocolErrorKind
impl Hash for ProtocolErrorKind
Source§impl PartialEq for ProtocolErrorKind
impl PartialEq for ProtocolErrorKind
Source§fn eq(&self, other: &ProtocolErrorKind) -> bool
fn eq(&self, other: &ProtocolErrorKind) -> bool
self and other values to be equal, and is used by ==.impl Copy for ProtocolErrorKind
impl Eq for ProtocolErrorKind
impl StructuralPartialEq for ProtocolErrorKind
Auto Trait Implementations§
impl Freeze for ProtocolErrorKind
impl RefUnwindSafe for ProtocolErrorKind
impl Send for ProtocolErrorKind
impl Sync for ProtocolErrorKind
impl Unpin for ProtocolErrorKind
impl UnsafeUnpin for ProtocolErrorKind
impl UnwindSafe for ProtocolErrorKind
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more