BoundaryML/baml · error · LimitsError
read capacity must fit inside normal capacity
Error message
read capacity must fit inside normal capacity
What it means
`LimitsError::ReadExceedsNormal`. The read capacity (reserved for a single in-flight message read) must fit inside the normal capacity; otherwise the read path could claim more than the ingress can hold. Validation rejects such limits.
Source
Thrown at baml_language/crates/baml_lsp_server/src/lsp_ingress.rs:262
normal_bytes: 4 * 1024 * 1024,
reserved_items: 64,
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 == 0View on GitHub (pinned to bd85ce9dee)
Solutions
- Increase the normal capacity so it is at least the read capacity
- Decrease the read capacity to fit within normal capacity
- Double-check constructor argument order (read vs normal) when building limits
- Add a startup assertion that read <= normal for your configured values
Example fix
// before: read exceeds normal let limits = IngressLimits::new(normal_items, 1 << 12, /*read*/ 1 << 20, 1 << 10)?; // after: read fits inside normal let limits = IngressLimits::new(normal_items, 1 << 20, /*read*/ 1 << 12, 1 << 10)?;
Defensive patterns
Strategy: validation
Validate before calling
fn read_fits(l_read: usize, l_normal: usize) -> bool { l_read <= l_normal } Try / catch
let read = read.min(normal); let limits = IngressLimits::new(items, normal_bytes, read, reservation)?;
Prevention
- Derive read capacity as a fraction of normal capacity
- Double-check parameter order when constructing limits
- Assert read <= normal in tests around limit configuration
When it happens
Trigger: Constructing `IngressLimits` where the read byte capacity (or read item capacity) is larger than the corresponding normal capacity, then validating.
Common situations: Tuning the read window up for large messages without raising the normal capacity; confusing the two parameters' order in a constructor call; copying limits between services with different units.
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
- all ingress capacities and the response reservation must be
- one response reservation must fit in the outbound byte capac
- combined normal and reserved capacity overflowed usize
- dependency name `{name}` is reserved
- {0}
AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12).
Data as JSON: /api/errors/d350ad672be0d0de.
Report an issue: GitHub.