booblik

BrokerError and ProtocolError

Generated page

Model gemma-mtp, commit ef58254ca7be, 2026-08-16, sources: 6. Edit the code or the hand-written documentation instead.

What this module is responsible for

This module provides the error hierarchy and protocol-level error definitions for the booblik client. It distinguishes between failures that occur during the transport of bytes and failures that occur when the broker logic rejects a validly framed request.

Diagram

BrokerError

The mechanics of handling refusals from the broker where the connection remains usable. A BrokerError occurs when the framing is intact and the broker understands the request, but declines it based on business logic (e.g., an invalid offset or topic) errors.js:25-32. Because the framing is intact, the connection stays usable for subsequent requests errors.js:21-24. The ErrorCode returned by the broker is mapped to a human-readable name via codeName errors.js:14-16.

ProtocolError

Handling of transport-level failures and framing issues. A ProtocolError is raised when the bytes on the connection do not make sense, such as a bad length prefix, a short response, or a lost socket errors.js:35-40. Unlike BrokerError, these issues often imply that the stream is no longer synchronized, potentially requiring a connection reset.

CorruptRecordError

The role of CRC-32C checksums in protecting the disk and the client's responsibility in verification. The client is the only party that can detect corruption because the broker uses zero-copy paths that do not touch the data bytes protocol-wire.md:154-156. If a client skips checksum verification, it effectively disables the project's primary defense against log corruption errors.js:48-49. The error includes the offset, stored checksum, and computed checksum to facilitate debugging errors.js:53-57.

RecordExceedsMaxBytesError

The distinction between broker-side record limits and client-side reading limits. This error is thrown when a record is larger than the client's own maxBytes limit, meaning the record can never be read in its entirety errors.js:67-71. This is distinct from Code.RECORD_TOO_LARGE, which refers to the broker's refusal to store a record that is too big for a segment errors.js:73-75.

ErrorCode

Enumeration of wire-level refusal codes.

CodeNameDescription
0NONESuccess
1UNKNOWN_TOPIC_OR_PARTITIONThe specified topic or partition does not exist errors.go:10-11
2OFFSET_OUT_OF_RANGEThe fetchOffset is outside the valid range protocol-wire.md:233
3RECORD_TOO_LARGEThe record does not fit in a segment protocol-wire.md:234
4UNSUPPORTED_VERSIONUnknown apiKey or apiVersion errors.go:14-15
5CORRUPT_REQUESTThe frame cannot be parsed errors.go:15-16

Key files

FileLinesWhat is there
…/src/errors.js3-32Definition of Code enum and BrokerError class
…/src/errors.js35-40Definition of ProtocolError class
…/src/errors.js51-63Definition of CorruptRecordError class
…/src/errors.js76-86Definition of RecordExceedsMaxBytesError class
…/go/errors.go10-16Go implementation of error codes

Behaviour that does not surprise

  • Session.handle will respond with an error and keep the connection open if RequestDecoder.decode returns a DecodeResult.Failed, because the framing was intact Session.kt:86-89.
  • Session.fetch will return an empty response (not an error) if the request.fetchOffset is exactly equal to the highWatermark Session.kt:197-200.
  • Session.produce will return no response at all (silence) if ackPolicy is set to NONE Session.kt:169.

On this page