{"record":{"id":"33abb2ff58ef7e2d","repo":"BoundaryML/baml","slug":"history-boundary-for-project-omitted-canonical-boundary-id","errorCode":null,"errorMessage":"history boundary for project {} omitted canonical boundary id","messagePattern":"history boundary for project (.+?) omitted canonical boundary id","errorType":"exception","errorClass":"io::Error","httpStatus":null,"severity":"error","filePath":"baml_language/crates/bex_events/src/history/mod.rs","lineNumber":626,"sourceCode":") -> io::Result<BoundaryId> {\n    if let Some(first) = header_boundary_ids.first().copied() {\n        if header_boundary_ids.iter().all(|id| *id == first) {\n            return Ok(first);\n        }\n        return Err(io::Error::new(\n            io::ErrorKind::InvalidData,\n            format!(\n                \"history boundary {} has inconsistent value segment boundary ids\",\n                fallback_dir\n                    .map(|dir| dir.display().to_string())\n                    .unwrap_or_else(|| \"byte segments\".to_string())\n            ),\n        ));\n    }\n    fallback_dir\n        .and_then(boundary_id_from_dir_name)\n        .ok_or_else(|| {\n            io::Error::new(\n                io::ErrorKind::InvalidData,\n                format!(\n                    \"history boundary for project {} omitted canonical boundary id\",\n                    started.request.project_id.0\n                ),\n            )\n        })\n}\n\nfn boundary_id_from_header(bytes: &[u8]) -> io::Result<BoundaryId> {\n    let bytes: [u8; 16] = bytes.try_into().map_err(|_| {\n        io::Error::new(\n            io::ErrorKind::InvalidData,\n            format!(\n                \".bamlvalue header boundary id must be 16 bytes, got {}\",\n                bytes.len()\n            ),\n        )","sourceCodeStart":608,"sourceCodeEnd":644,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/bex_events/src/history/mod.rs#L608-L644","documentation":"When segment headers yield no consistent boundary ID, the fallback derives the canonical ID from the directory name; if that also fails (no fallback dir or an unparseable dir name), InvalidData is returned, including the run's project_id. The library refuses to open a boundary whose identity cannot be established from headers or directory name.","triggerScenarios":"open_boundary_from_segments given byte segments with inconsistent/absent header IDs and either no fallback directory or a directory name that isn't a valid boundary-ID name, for the given project.","commonSituations":"Replaying from in-memory segments with no directory context; renaming a boundary directory with a non-wire-format name; passing a scratch dir whose name doesn't encode the boundary ID.","solutions":["Ensure segment headers carry a consistent boundary ID so the fallback isn't needed.","If relying on the fallback, name the directory with the boundary's wire-format ID (as to_wire_string produces).","Pass the original, unrenamed boundary directory when opening from disk.","Cross-check the project_id in the message against the run you intend to open."],"exampleFix":"// before\nlet dir = std::env::temp_dir().join(\"scratch\");\nlet id = boundary_id_from_header_or_fallback(&segs, Some(&dir), &started)?;\n// after\nlet dir = std::env::temp_dir().join(started.request.run_id.to_wire_string());\nlet id = boundary_id_from_header_or_fallback(&segs, Some(&dir), &started)?;","handlingStrategy":"validation","validationCode":"let dir = match fallback_dir {\n    Some(d) => d,\n    None => return Err(\"need a boundary-named directory when headers lack IDs\".into()),\n};\nif BoundaryId::parse_from_dir_name(&dir).is_none() {\n    return Err(format!(\"dir name {} is not a boundary id\", dir.display()));\n}","typeGuard":null,"tryCatchPattern":"match open_boundary_from_segments(fallback_dir.as_deref(), &segments) {\n    Err(e) if e.kind() == std::io::ErrorKind::InvalidData => {\n        Err(ReplayError::UnidentifiableBoundary(project_id))\n    }\n    other => other,\n}","preventionTips":["Keep consistent boundary IDs in all segment headers so no fallback is needed.","Name boundary directories with the exact wire-format boundary ID.","Avoid renaming or moving boundary directories after recording."],"tags":["io","invalid-data","history","identity"],"backgroundTag":"missing-required-argument","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"}