BoundaryML/baml · error
BAML_CACHE_VERIFY: cached stdlib interface for package
Error message
BAML_CACHE_VERIFY: cached stdlib interface for package `{name}` differs from a fresh derivation ({} vs {} bytes). The cached typed interface is a stale or incomplete substitute — please report this. What it means
Error "BAML_CACHE_VERIFY: cached stdlib interface for package `{name}` differs from a fresh derivation ({} vs {} bytes). The cached typed interface is a stale or incomplete substitute — please report this." thrown in BoundaryML/baml.
Solutions
- Clear the stale cache (remove the cached bytecode artifacts or run with the cache disabled) and recompile so fresh stdlib interfaces are re-derived and re-cached
- If the mismatch persists on a clean cache, report it to the BAML maintainers — the typed-interface derivation is nondeterministic or the cache key omits an input
- Keep BAML_CACHE_VERIFY enabled in CI to catch stale cached export data early
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at baml_language/crates/baml_cli/src/bytecode_cache.rs:309 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12).
Data as JSON: /api/errors/565c6022a01dbc87.
Report an issue: GitHub.
Appendix: source
Thrown at baml_language/crates/baml_cli/src/bytecode_cache.rs:309
/// Localized B-694 verify oracle (analog of `gocacheverify`): under
/// `BAML_CACHE_VERIFY` the stdlib seed is *not* applied, so `db` derives every
/// stdlib interface honestly; this compares that derivation byte-for-byte
/// against any cached blob. A mismatch means the cached "export data" is a
/// stale substitute that would change typecheck results — a hard error, and a
/// tighter signal than the whole-`Program` byte-compare (it names the drifted
/// package).
pub(crate) fn verify_stdlib_interface(&self, db: &ProjectDatabase) -> anyhow::Result<()> {
if !Self::verify_enabled() {
return Ok(());
}
let Some(cached) = self.load_raw_stdlib_interface_for_verify() else {
return Ok(());
};
let derived = extract_stdlib_interface(db);
for (name, derived_bytes) in &derived {
if let Some(cached_bytes) = cached.get(name) {
if cached_bytes != derived_bytes {
anyhow::bail!(
"BAML_CACHE_VERIFY: cached stdlib interface for package `{name}` differs \
from a fresh derivation ({} vs {} bytes). The cached typed interface is a \
stale or incomplete substitute — please report this.",
cached_bytes.len(),
derived_bytes.len(),
);
}
}
}
Ok(())
}
/// Read the cached interface blob for the verify oracle, bypassing the
/// `BAML_NO_STDLIB_INTERFACE_CACHE` disable (verify must still compare
/// against whatever is on disk).
fn load_raw_stdlib_interface_for_verify(
&self,
) -> Option<std::collections::BTreeMap<String, Vec<u8>>> {View on GitHub (pinned to bd85ce9dee)