{"record":{"id":"4091b9433a7147f6","repo":"BoundaryML/baml","slug":"precompiled-stdlib-is-missing-package-package","errorCode":null,"errorMessage":"precompiled stdlib is missing package `{package}`","messagePattern":"precompiled stdlib is missing package `(.+?)`","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"baml_language/crates/baml_db/src/db.rs","lineNumber":428,"sourceCode":"        });\n    }\n\n    /// Install one `Stdlib` root per embedded builtin package served from its\n    /// compiler-built interface (`borsh(PackageInterface)`, keyed by package\n    /// name) instead of from source — the runtime compiler's shape, where the\n    /// stdlib arrives precompiled and no builtin source is materialized. The\n    /// dependency edges come from the embedded manifests exactly as for\n    /// source roots.\n    ///\n    /// # Panics\n    ///\n    /// Panics if `interfaces` lacks a stdlib package: a precompiled stdlib is\n    /// all-or-nothing.\n    pub fn ensure_precompiled_stdlib(&mut self, interfaces: &BTreeMap<String, Vec<u8>>) {\n        self.install_stdlib(|package| StdlibProvenance::Interface {\n            bytes: interfaces\n                .get(package)\n                .unwrap_or_else(|| panic!(\"precompiled stdlib is missing package `{package}`\"))\n                .clone(),\n        });\n    }\n\n    /// The one stdlib installer: create (or reuse) the roots of\n    /// [`stdlib_layout`] in dependency order, each with its manifest-declared\n    /// edges, and record the prelude every later root receives at creation.\n    ///\n    /// # Panics\n    ///\n    /// Panics if a non-`Stdlib` root already exists: the stdlib is installed\n    /// first, so its roots are the lowest ids in the database and the root\n    /// order the type algebra sorts by agrees with the table order emit\n    /// iterates.\n    fn install_stdlib(&mut self, provenance: impl Fn(&str) -> StdlibProvenance) {\n        // The stdlib is installed before any other root, so the stdlib roots\n        // are the lowest ids in the database: the root order the type algebra\n        // sorts by (creation order) and the table order emit iterates agree","sourceCodeStart":410,"sourceCodeEnd":446,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/baml_db/src/db.rs#L410-L446","documentation":"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.","triggerScenarios":"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!)`).","commonSituations":"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.","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."],"exampleFix":"// before\ndb.ensure_precompiled_stdlib(&partial_map); // missing \"core\"\n// after\nlet full: BTreeMap<String, Vec<u8>> = stdlib_layout().packages.iter()\n    .map(|p| Ok((p.name.to_string(), get_interface(p.name)?)))\n    .collect::<Result<_, _>>()?;\ndb.ensure_precompiled_stdlib(&full);","handlingStrategy":"validation","validationCode":"fn interfaces_complete(map: &BTreeMap<String, Vec<u8>>) -> Result<(), Vec<String>> {\n    let missing: Vec<String> = stdlib_layout().packages.iter()\n        .map(|p| p.name.to_string())\n        .filter(|n| !map.contains_key(n))\n        .collect();\n    if missing.is_empty() { Ok(()) } else { Err(missing) }\n}","typeGuard":null,"tryCatchPattern":"// This is a panic, not a Result: validate the map beforehand and fail gracefully.\nif let Err(missing) = interfaces_complete(&interfaces) {\n    panic!(\"precompiled stdlib incomplete; missing: {missing:?}\");\n}\ndb.ensure_precompiled_stdlib(&interfaces);","preventionTips":["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."],"tags":["panic","stdlib","rust","missing-artifact"],"backgroundTag":"missing-dependency","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"}