BoundaryML/baml · error

BAML_CACHE_VERIFY: cached stdlib (builtin) diagnostics…

Error message

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.

What it means

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.

Solutions

  1. Delete the cached builtin-diagnostics blob (or the whole cache directory) so the honest builtin check is recomputed and re-cached
  2. 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
  3. Run with BAML_CACHE_VERIFY set in CI to detect stale substitutes before they affect typecheck results
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at baml_language/crates/baml_cli/src/bytecode_cache.rs:399 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/bcc56190e1423287. Report an issue: GitHub.

Appendix: source

Thrown at baml_language/crates/baml_cli/src/bytecode_cache.rs:399

        let honest = crate::diagnostics_cache::collect_builtin_diagnostics(db);
        Self::compare_stdlib_diagnostics(db, &cached_blob, &honest)
    }

    /// The env-independent core of [`Self::verify_stdlib_diagnostics`], so the
    /// oracle's discriminating power (pass on a faithful blob, bail on a stale
    /// one) is unit-testable without mutating the process environment. An
    /// undecodable blob is *not* a violation — the warm path degrades to the
    /// honest builtin check, never serving a partial set — so it passes.
    pub(crate) fn compare_stdlib_diagnostics(
        db: &ProjectDatabase,
        cached_blob: &[u8],
        honest: &[baml_db::baml_compiler_diagnostics::Diagnostic],
    ) -> anyhow::Result<()> {
        let Some(cached) = crate::diagnostics_cache::rehydrate_builtin_blob(db, cached_blob) else {
            return Ok(());
        };
        if !diagnostic_sets_equal(&cached, honest) {
            anyhow::bail!(
                "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.",
                cached.len(),
                honest.len(),
            );
        }
        Ok(())
    }
}

/// The cached `baml test --list` **discovery output**: everything a `--list`
/// invocation renders, in the exact order it renders it, *unfiltered* so any
/// `-i`/`-x` selection is served from one entry (the filter is re-applied live
/// in Rust via `TestFilter`, which mirrors `testing.leaf_selected`).
///
/// This is a pure function of the compiled Program (same sources + compiler
/// build ⇒ same tests), so it is keyed by the Program's own cache key

View on GitHub (pinned to bd85ce9dee)