{"record":{"id":"b4ca603cf367721b","repo":"BoundaryML/baml","slug":"wasm-history-boundary-was-not-found","errorCode":null,"errorMessage":"WASM history boundary {} was not found","messagePattern":"WASM history boundary (.+?) was not found","errorType":"exception","errorClass":"io::Error","httpStatus":null,"severity":"error","filePath":"baml_language/crates/bridge_wasm/src/runs.rs","lineNumber":190,"sourceCode":"        boundary.value_writer.flush()?;\n        Ok(())\n    }\n\n    fn list(&self, filter: &RunFilter) -> Vec<RunSummary> {\n        let mut summaries = self\n            .boundaries\n            .keys()\n            .filter_map(|boundary_id| self.open(*boundary_id).ok())\n            .filter(|run| history_run_matches_filter(run, filter))\n            .map(|run| summarize_history_run(&run))\n            .collect::<Vec<_>>();\n        summaries.sort_by_key(|summary| std::cmp::Reverse(summary.created_at_ms));\n        summaries\n    }\n\n    fn open(&self, boundary_id: BoundaryId) -> io::Result<bex_events::run::Run> {\n        let boundary = self.boundaries.get(&boundary_id).ok_or_else(|| {\n            io::Error::new(\n                io::ErrorKind::NotFound,\n                format!(\n                    \"WASM history boundary {} was not found\",\n                    boundary_id.to_wire_string()\n                ),\n            )\n        })?;\n        let value_segments = boundary.value_segments();\n        open_boundary_from_value_segments(&value_segments)\n    }\n\n    fn read_value(\n        &self,\n        boundary_id: BoundaryId,\n        value_ref_id: &str,\n    ) -> io::Result<HistoryValueReadResult> {\n        let Some(boundary) = self.boundaries.get(&boundary_id) else {\n            return Ok(HistoryValueReadResult::Missing);","sourceCodeStart":172,"sourceCodeEnd":208,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/bridge_wasm/src/runs.rs#L172-L208","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nconst run = runs.open(idFromStorage);\n// after\nconst known = runs.list_summaries().some(s => s.id === idFromStorage);\nconst run = known ? runs.open(idFromStorage) : null;","handlingStrategy":"try-catch","validationCode":"function boundaryExists(runs, id) {\n  return runs.list_summaries().some(s => s.id === id);\n}","typeGuard":null,"tryCatchPattern":"try {\n  const run = runs.open(boundaryId);\n} catch (e) {\n  if (String(e.message).includes('was not found')) {\n    run = null; // history unavailable in this session\n  } else throw e;\n}","preventionTips":["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"],"tags":["wasm","io","history"],"backgroundTag":"resource-not-found","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}