{"record":{"id":"bcc56190e1423287","repo":"BoundaryML/baml","slug":"baml-cache-verify-cached-stdlib-builtin-diagnostics-differ","errorCode":null,"errorMessage":"BAML_CACHE_VERIFY: cached stdlib (builtin) diagnostics differ from a fresh check ({} cached vs {} honest). The cached builtin-diagnostics blob is a stale substitute — please report this.","messagePattern":"BAML_CACHE_VERIFY: cached stdlib \\(builtin\\) diagnostics differ from a fresh check \\((.+?) cached vs (.+?) honest\\)\\. The cached builtin-diagnostics blob is a stale substitute — please report this\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"baml_language/crates/baml_cli/src/bytecode_cache.rs","lineNumber":399,"sourceCode":"        let honest = crate::diagnostics_cache::collect_builtin_diagnostics(db);\n        Self::compare_stdlib_diagnostics(db, &cached_blob, &honest)\n    }\n\n    /// The env-independent core of [`Self::verify_stdlib_diagnostics`], so the\n    /// oracle's discriminating power (pass on a faithful blob, bail on a stale\n    /// one) is unit-testable without mutating the process environment. An\n    /// undecodable blob is *not* a violation — the warm path degrades to the\n    /// honest builtin check, never serving a partial set — so it passes.\n    pub(crate) fn compare_stdlib_diagnostics(\n        db: &ProjectDatabase,\n        cached_blob: &[u8],\n        honest: &[baml_db::baml_compiler_diagnostics::Diagnostic],\n    ) -> anyhow::Result<()> {\n        let Some(cached) = crate::diagnostics_cache::rehydrate_builtin_blob(db, cached_blob) else {\n            return Ok(());\n        };\n        if !diagnostic_sets_equal(&cached, honest) {\n            anyhow::bail!(\n                \"BAML_CACHE_VERIFY: cached stdlib (builtin) diagnostics differ from a fresh \\\n                 check ({} cached vs {} honest). The cached builtin-diagnostics blob is a stale \\\n                 substitute — please report this.\",\n                cached.len(),\n                honest.len(),\n            );\n        }\n        Ok(())\n    }\n}\n\n/// The cached `baml test --list` **discovery output**: everything a `--list`\n/// invocation renders, in the exact order it renders it, *unfiltered* so any\n/// `-i`/`-x` selection is served from one entry (the filter is re-applied live\n/// in Rust via `TestFilter`, which mirrors `testing.leaf_selected`).\n///\n/// This is a pure function of the compiled Program (same sources + compiler\n/// build ⇒ same tests), so it is keyed by the Program's own cache key","sourceCodeStart":381,"sourceCodeEnd":417,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/baml_cli/src/bytecode_cache.rs#L381-L417","documentation":"Error \"BAML_CACHE_VERIFY: cached stdlib (builtin) diagnostics differ from a fresh check ({} cached vs {} honest). The cached builtin-diagnostics blob is a stale substitute — please report this.\" thrown in BoundaryML/baml.","triggerScenarios":"Thrown at baml_language/crates/baml_cli/src/bytecode_cache.rs:399 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Delete the cached builtin-diagnostics blob (or the whole cache directory) so the honest builtin check is recomputed and re-cached","If it reappears after a clean rebuild, report the issue to the BAML maintainers — stdlib builtin diagnostics may be environment-dependent in a way the cache key misses","Run with BAML_CACHE_VERIFY set in CI to detect stale substitutes before they affect typecheck results"],"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"}