BoundaryML/baml · error · LimitsError

one response reservation must fit in the outbound byte capac

Error message

one response reservation must fit in the outbound byte capacity

What it means

`LimitsError::ResponseReservationTooLarge`. Each in-flight response reserves bytes from the outbound byte capacity; that per-response reservation must fit within the total outbound byte capacity, otherwise even a single response could not be admitted. Validation rejects such limits.

Source

Thrown at baml_language/crates/baml_lsp_server/src/lsp_ingress.rs:264

            reserved_bytes: 2 * 1024 * 1024,
            read_items: 128,
            read_bytes: 2 * 1024 * 1024,
            control_items: 64,
            control_bytes: 64 * 1024,
            outbound_response_items: 256,
            outbound_response_bytes: 4 * 1024 * 1024,
            response_reservation_bytes: 16 * 1024,
        }
    }
}

#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
pub enum LimitsError {
    #[error("all ingress capacities and the response reservation must be non-zero")]
    ZeroCapacity,
    #[error("read capacity must fit inside normal capacity")]
    ReadExceedsNormal,
    #[error("one response reservation must fit in the outbound byte capacity")]
    ResponseReservationTooLarge,
    #[error("combined normal and reserved capacity overflowed usize")]
    CapacityOverflow,
}

impl IngressLimits {
    fn validate(self) -> Result<Self, LimitsError> {
        if self.normal_items == 0
            || self.normal_bytes == 0
            || self.reserved_items == 0
            || self.reserved_bytes == 0
            || self.read_items == 0
            || self.read_bytes == 0
            || self.control_items == 0
            || self.control_bytes == 0
            || self.outbound_response_items == 0
            || self.outbound_response_bytes == 0
            || self.response_reservation_bytes == 0

View on GitHub (pinned to bd85ce9dee)

Solutions

  1. Increase the outbound byte capacity so at least one reservation fits
  2. Decrease the per-response reservation to be <= outbound byte capacity
  3. Recompute reservation and outbound capacity together when changing message size limits
  4. Validate at startup and log all limit values for diagnosability

Example fix

// before: reservation larger than outbound capacity
let limits = IngressLimits::new(items, normal_bytes, read_bytes, /*reservation*/ 4 << 20, /*outbound*/ 1 << 20)?;

// after: reservation fits
let limits = IngressLimits::new(items, normal_bytes, read_bytes, /*reservation*/ 1 << 20, /*outbound*/ 4 << 20)?;
Defensive patterns

Strategy: validation

Validate before calling

fn reservation_fits(reservation: usize, outbound: usize) -> bool { reservation <= outbound }

Try / catch

let reservation = reservation.min(outbound_bytes);
let limits = IngressLimits::new(items, normal_bytes, read_bytes, reservation, outbound_bytes)?;

Prevention

When it happens

Trigger: Constructing `IngressLimits` where the per-response byte reservation is greater than the outbound byte capacity, then validating.

Common situations: Raising the reservation to accommodate large responses while leaving the outbound byte budget small; unit confusion (e.g. reserving in bytes but configuring outbound in KiB); a default reservation kept after shrinking outbound capacity.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12). Data as JSON: /api/errors/4e86aab03cfb1338. Report an issue: GitHub.