BoundaryML/baml · error · io::Error
WASM history boundary {} was not begun
Error message
WASM history boundary {} was not begun What it means
append_log_body in the WASM runs store requires a history boundary that was previously begun via begin(). The call looks up the BoundaryId in the boundaries map and, when absent, returns an io::Error of kind NotFound saying the boundary 'was not begun'. It means the caller is appending a log body to a run whose lifecycle was never started (or already finished/removed).
Source
Thrown at baml_language/crates/bridge_wasm/src/runs.rs:114
value_writer.append_run_started(&RunStartedRecord {
request: start.request.clone(),
created_at_ms: start.created_at_ms,
time_anchor: start.time_anchor,
})?;
self.boundaries
.insert(start.boundary_id, WasmHistoryBoundary { value_writer });
Ok(())
}
fn append_log_body(
&mut self,
boundary_id: BoundaryId,
event: LogEventRecord,
codec: ValueCodec,
body: Vec<u8>,
) -> io::Result<ValueWriteOutcome> {
let boundary = self.boundaries.get_mut(&boundary_id).ok_or_else(|| {
io::Error::new(
io::ErrorKind::NotFound,
format!(
"WASM history boundary {} was not begun",
boundary_id.to_wire_string()
),
)
})?;
boundary.value_writer.append_log_body(codec, body, event)
}
fn append_capture_loss(
&mut self,
boundary_id: BoundaryId,
record: &CaptureLossRecord,
) -> io::Result<()> {
let boundary = self.boundaries.get_mut(&boundary_id).ok_or_else(|| {
io::Error::new(
io::ErrorKind::NotFound,View on GitHub (pinned to bd85ce9dee)
Solutions
- Ensure begin() is called for the boundary before any append_log_body call
- Verify the BoundaryId is the one returned by begin(), not reconstructed from wire bytes of a closed run
- Check ordering in your JS glue code so bodies are appended before the run is finished/dropped
- Handle the io NotFound error in the JS caller and re-begin the boundary if replaying history
Example fix
// before runs.append_log_body(boundaryId, event, codec, body); // after if (!runs.hasBoundary(boundaryId)) boundaryId = runs.begin(meta); runs.append_log_body(boundaryId, event, codec, body);
Defensive patterns
Strategy: validation
Validate before calling
function canAppendBody(runs, boundaryId) {
return typeof runs.hasBoundary === 'function' && runs.hasBoundary(boundaryId);
} Try / catch
try {
runs.append_log_body(boundaryId, event, codec, body);
} catch (e) {
if (String(e.message).includes('was not begun')) {
boundaryId = runs.begin(meta); // re-begin and retry once
runs.append_log_body(boundaryId, event, codec, body);
} else throw e;
} Prevention
- Always begin() a boundary before appending any records
- Keep boundary IDs from begin() return values, never reconstruct them
- Append bodies before finishing/closing the run
- Track boundary lifecycle centrally in glue code
When it happens
Trigger: Calling append_log_body with a BoundaryId that was never created, that was already completed, or from a stale reference after the boundary map dropped it.
Common situations: Happens in WASM test harnesses and replay paths (e.g. warm_history_replays_log_payload_and_body_without_live_runstore) when log bodies are appended after the run was torn down, or when boundary IDs are recreated/reused across page reloads.
Understand the failure class
Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.
Related errors
- WASM history boundary {} was not found
- {}: {error}
- BAML internal error - credential provider bridges not initia
- no filesystem is attached to this server ({})
- -32002
AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12).
Data as JSON: /api/errors/b0b3f32e6f2952d0.
Report an issue: GitHub.