BoundaryML/baml · critical
precompiled stdlib is missing package `{package}`
Error message
precompiled stdlib is missing package `{package}` What it means
Panic from `ProjectDatabase::ensure_precompiled_stdlib`. A precompiled stdlib is all-or-nothing: the supplied `interfaces` map must contain an entry for every embedded stdlib package. When a package's name is missing from the map, the installer panics rather than silently leaving the stdlib incomplete.
Source
Thrown at baml_language/crates/baml_db/src/db.rs:428
});
}
/// Install one `Stdlib` root per embedded builtin package served from its
/// compiler-built interface (`borsh(PackageInterface)`, keyed by package
/// name) instead of from source — the runtime compiler's shape, where the
/// stdlib arrives precompiled and no builtin source is materialized. The
/// dependency edges come from the embedded manifests exactly as for
/// source roots.
///
/// # Panics
///
/// Panics if `interfaces` lacks a stdlib package: a precompiled stdlib is
/// all-or-nothing.
pub fn ensure_precompiled_stdlib(&mut self, interfaces: &BTreeMap<String, Vec<u8>>) {
self.install_stdlib(|package| StdlibProvenance::Interface {
bytes: interfaces
.get(package)
.unwrap_or_else(|| panic!("precompiled stdlib is missing package `{package}`"))
.clone(),
});
}
/// The one stdlib installer: create (or reuse) the roots of
/// [`stdlib_layout`] in dependency order, each with its manifest-declared
/// edges, and record the prelude every later root receives at creation.
///
/// # Panics
///
/// Panics if a non-`Stdlib` root already exists: the stdlib is installed
/// first, so its roots are the lowest ids in the database and the root
/// order the type algebra sorts by agrees with the table order emit
/// iterates.
fn install_stdlib(&mut self, provenance: impl Fn(&str) -> StdlibProvenance) {
// The stdlib is installed before any other root, so the stdlib roots
// are the lowest ids in the database: the root order the type algebra
// sorts by (creation order) and the table order emit iterates agreeView on GitHub (pinned to bd85ce9dee)
Solutions
- Build the interfaces map from the same embedded stdlib layout so every package is present.
- Log which keys are missing versus the expected package names before calling.
- Regenerate the full precompiled stdlib artifact set for the current compiler version.
Example fix
// before
db.ensure_precompiled_stdlib(&partial_map); // missing "core"
// after
let full: BTreeMap<String, Vec<u8>> = stdlib_layout().packages.iter()
.map(|p| Ok((p.name.to_string(), get_interface(p.name)?)))
.collect::<Result<_, _>>()?;
db.ensure_precompiled_stdlib(&full); Defensive patterns
Strategy: validation
Validate before calling
fn interfaces_complete(map: &BTreeMap<String, Vec<u8>>) -> Result<(), Vec<String>> {
let missing: Vec<String> = stdlib_layout().packages.iter()
.map(|p| p.name.to_string())
.filter(|n| !map.contains_key(n))
.collect();
if missing.is_empty() { Ok(()) } else { Err(missing) }
} Try / catch
// This is a panic, not a Result: validate the map beforehand and fail gracefully.
if let Err(missing) = interfaces_complete(&interfaces) {
panic!("precompiled stdlib incomplete; missing: {missing:?}");
}
db.ensure_precompiled_stdlib(&interfaces); Prevention
- Derive the interfaces map keys from the same stdlib layout the installer iterates.
- Fail fast with a clear message listing missing package names before installation.
- Regenerate the full artifact set on every compiler version bump.
When it happens
Trigger: Calling `ensure_precompiled_stdlib(&BTreeMap<String, Vec<u8>>)` whose key set does not cover all stdlib package names (checked inside the installer via `interfaces.get(package).unwrap_or_else(panic!)`).
Common situations: Partially populated interface maps produced by an artifact build that skipped a package; key/name mismatch between the embedded stdlib manifest and the map keys after a version bump.
Understand the failure class
Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.
Related errors
- cannot install the stdlib source root for `{}`: {err}
- `{BAML_JSON_JSON}` is declared by the stdlib
- sys_op callee must resolve to a statically-known global func
- expected jump instruction at index {instruction_idx}
- exhaustive realized-leaf template classification
AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12).
Data as JSON: /api/errors/4091b9433a7147f6.
Report an issue: GitHub.