BoundaryML/baml · error · io::Error
WASM history boundary {} was not found
Error message
WASM history boundary {} was not found What it means
The open method of the WASM history store resolves a BoundaryId to a stored run; if the id is not present in the boundaries map it returns io::Error NotFound 'WASM history boundary ... was not found'. Unlike the 'not begun' errors, open() only reads, so this means no such boundary exists at all (never created in this instance, or already evicted).
Source
Thrown at baml_language/crates/bridge_wasm/src/runs.rs:190
boundary.value_writer.flush()?;
Ok(())
}
fn list(&self, filter: &RunFilter) -> Vec<RunSummary> {
let mut summaries = self
.boundaries
.keys()
.filter_map(|boundary_id| self.open(*boundary_id).ok())
.filter(|run| history_run_matches_filter(run, filter))
.map(|run| summarize_history_run(&run))
.collect::<Vec<_>>();
summaries.sort_by_key(|summary| std::cmp::Reverse(summary.created_at_ms));
summaries
}
fn open(&self, boundary_id: BoundaryId) -> io::Result<bex_events::run::Run> {
let boundary = self.boundaries.get(&boundary_id).ok_or_else(|| {
io::Error::new(
io::ErrorKind::NotFound,
format!(
"WASM history boundary {} was not found",
boundary_id.to_wire_string()
),
)
})?;
let value_segments = boundary.value_segments();
open_boundary_from_value_segments(&value_segments)
}
fn read_value(
&self,
boundary_id: BoundaryId,
value_ref_id: &str,
) -> io::Result<HistoryValueReadResult> {
let Some(boundary) = self.boundaries.get(&boundary_id) else {
return Ok(HistoryValueReadResult::Missing);View on GitHub (pinned to bd85ce9dee)
Solutions
- Re-register or re-begin the boundary in the current WASM instance before opening it
- Validate boundary ids against boundaries.list()/summaries before calling open
- Treat NotFound as 'history unavailable in this session' in the UI instead of failing hard
- Do not persist BoundaryId wire strings across reloads as valid handles
Example fix
// before const run = runs.open(idFromStorage); // after const known = runs.list_summaries().some(s => s.id === idFromStorage); const run = known ? runs.open(idFromStorage) : null;
Defensive patterns
Strategy: try-catch
Validate before calling
function boundaryExists(runs, id) {
return runs.list_summaries().some(s => s.id === id);
} Try / catch
try {
const run = runs.open(boundaryId);
} catch (e) {
if (String(e.message).includes('was not found')) {
run = null; // history unavailable in this session
} else throw e;
} Prevention
- Never treat persisted BoundaryId strings as valid across reloads
- Validate ids against list_summaries() before opening
- Re-register needed boundaries after WASM module (re)initialization
- Render 'history unavailable' states in UI for NotFound
When it happens
Trigger: Calling open with a BoundaryId from a previous session/reload, a typo'd wire string, or after the boundary was removed; also invoked by list paths that iterate stale ids.
Common situations: Page reloads in the browser lose in-memory WASM state while persisted boundary ids remain in history listings; replay code (warm_history...) referencing ids not re-registered in the new instance.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- history boundary {} was not begun
- history boundary {} was not found
- failed to read value segment {}: {error}
- history boundary {} omitted run started record
- history boundary {} has inconsistent value segment boundary
AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12).
Data as JSON: /api/errors/b4ca603cf367721b.
Report an issue: GitHub.