{"record":{"id":"565c6022a01dbc87","repo":"BoundaryML/baml","slug":"baml-cache-verify-cached-stdlib-interface-for-package-name","errorCode":null,"errorMessage":"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.","messagePattern":"BAML_CACHE_VERIFY: cached stdlib interface for package `(.+?)` differs from a fresh derivation \\((.+?) vs (.+?) bytes\\)\\. The cached typed interface is a stale or incomplete substitute — please report this\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"baml_language/crates/baml_cli/src/bytecode_cache.rs","lineNumber":309,"sourceCode":"    /// Localized B-694 verify oracle (analog of `gocacheverify`): under\n    /// `BAML_CACHE_VERIFY` the stdlib seed is *not* applied, so `db` derives every\n    /// stdlib interface honestly; this compares that derivation byte-for-byte\n    /// against any cached blob. A mismatch means the cached \"export data\" is a\n    /// stale substitute that would change typecheck results — a hard error, and a\n    /// tighter signal than the whole-`Program` byte-compare (it names the drifted\n    /// package).\n    pub(crate) fn verify_stdlib_interface(&self, db: &ProjectDatabase) -> anyhow::Result<()> {\n        if !Self::verify_enabled() {\n            return Ok(());\n        }\n        let Some(cached) = self.load_raw_stdlib_interface_for_verify() else {\n            return Ok(());\n        };\n        let derived = extract_stdlib_interface(db);\n        for (name, derived_bytes) in &derived {\n            if let Some(cached_bytes) = cached.get(name) {\n                if cached_bytes != derived_bytes {\n                    anyhow::bail!(\n                        \"BAML_CACHE_VERIFY: cached stdlib interface for package `{name}` differs \\\n                         from a fresh derivation ({} vs {} bytes). The cached typed interface is a \\\n                         stale or incomplete substitute — please report this.\",\n                        cached_bytes.len(),\n                        derived_bytes.len(),\n                    );\n                }\n            }\n        }\n        Ok(())\n    }\n\n    /// Read the cached interface blob for the verify oracle, bypassing the\n    /// `BAML_NO_STDLIB_INTERFACE_CACHE` disable (verify must still compare\n    /// against whatever is on disk).\n    fn load_raw_stdlib_interface_for_verify(\n        &self,\n    ) -> Option<std::collections::BTreeMap<String, Vec<u8>>> {","sourceCodeStart":291,"sourceCodeEnd":327,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/baml_cli/src/bytecode_cache.rs#L291-L327","documentation":"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.","triggerScenarios":"Thrown at baml_language/crates/baml_cli/src/bytecode_cache.rs:309 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}