{"record":{"id":"4e86aab03cfb1338","repo":"BoundaryML/baml","slug":"one-response-reservation-must-fit-in-the-outbound-byte","errorCode":null,"errorMessage":"one response reservation must fit in the outbound byte capacity","messagePattern":"one response reservation must fit in the outbound byte capacity","errorType":"validation","errorClass":"LimitsError","httpStatus":null,"severity":"error","filePath":"baml_language/crates/baml_lsp_server/src/lsp_ingress.rs","lineNumber":264,"sourceCode":"            reserved_bytes: 2 * 1024 * 1024,\n            read_items: 128,\n            read_bytes: 2 * 1024 * 1024,\n            control_items: 64,\n            control_bytes: 64 * 1024,\n            outbound_response_items: 256,\n            outbound_response_bytes: 4 * 1024 * 1024,\n            response_reservation_bytes: 16 * 1024,\n        }\n    }\n}\n\n#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]\npub enum LimitsError {\n    #[error(\"all ingress capacities and the response reservation must be non-zero\")]\n    ZeroCapacity,\n    #[error(\"read capacity must fit inside normal capacity\")]\n    ReadExceedsNormal,\n    #[error(\"one response reservation must fit in the outbound byte capacity\")]\n    ResponseReservationTooLarge,\n    #[error(\"combined normal and reserved capacity overflowed usize\")]\n    CapacityOverflow,\n}\n\nimpl IngressLimits {\n    fn validate(self) -> Result<Self, LimitsError> {\n        if self.normal_items == 0\n            || self.normal_bytes == 0\n            || self.reserved_items == 0\n            || self.reserved_bytes == 0\n            || self.read_items == 0\n            || self.read_bytes == 0\n            || self.control_items == 0\n            || self.control_bytes == 0\n            || self.outbound_response_items == 0\n            || self.outbound_response_bytes == 0\n            || self.response_reservation_bytes == 0","sourceCodeStart":246,"sourceCodeEnd":282,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/baml_lsp_server/src/lsp_ingress.rs#L246-L282","documentation":"`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.","triggerScenarios":"Constructing `IngressLimits` where the per-response byte reservation is greater than the outbound byte capacity, then validating.","commonSituations":"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.","solutions":["Increase the outbound byte capacity so at least one reservation fits","Decrease the per-response reservation to be <= outbound byte capacity","Recompute reservation and outbound capacity together when changing message size limits","Validate at startup and log all limit values for diagnosability"],"exampleFix":"// before: reservation larger than outbound capacity\nlet limits = IngressLimits::new(items, normal_bytes, read_bytes, /*reservation*/ 4 << 20, /*outbound*/ 1 << 20)?;\n\n// after: reservation fits\nlet limits = IngressLimits::new(items, normal_bytes, read_bytes, /*reservation*/ 1 << 20, /*outbound*/ 4 << 20)?;","handlingStrategy":"validation","validationCode":"fn reservation_fits(reservation: usize, outbound: usize) -> bool { reservation <= outbound }","typeGuard":null,"tryCatchPattern":"let reservation = reservation.min(outbound_bytes);\nlet limits = IngressLimits::new(items, normal_bytes, read_bytes, reservation, outbound_bytes)?;","preventionTips":["Recompute reservation whenever outbound capacity changes","Keep reservation <= outbound/2 so multiple responses can be in flight","Document units for both fields to avoid byte/KiB confusion"],"tags":["lsp","rust","validation","limits"],"backgroundTag":"invalid-config-value","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}