BoundaryML/baml · error · Error

Update to @boundaryml/baml required. Version from generators

Error message

Update to @boundaryml/baml required.
Version from generators.baml: ${generatedVersion}
Current @boundaryml/baml version: ${runtimeVersion}

Please upgrade @boundaryml/baml to version ${generatedVersion}.

$ npm install @boundaryml/baml@${generatedVersion}
$ yarn add @boundaryml/baml@${generatedVersion}
$ pnpm add @boundaryml/baml@${generatedVersion}

If nothing else works, please ask for help:

https://github.com/boundaryml/baml/issues
https://boundaryml.com/discord

What it means

Generated BAML client code embeds the @boundaryml/baml version it was generated with (generators.baml). At import time ThrowIfVersionMismatch compares it with the installed runtime version and throws if the runtime is older, because the generated code may use APIs the runtime lacks.

Source

Thrown at engine/language_client_typescript/safe_imports.js:32

}
function ThrowIfVersionMismatch(generatedVersion) {
    const runtimeVersion = (0, native_1.get_version)();
    if (!ensureVersionCompatibility(generatedVersion, runtimeVersion)) {
        const errorMessage = `Update to @boundaryml/baml required.
Version from generators.baml: ${generatedVersion}
Current @boundaryml/baml version: ${runtimeVersion}

Please upgrade @boundaryml/baml to version ${generatedVersion}.

$ npm install @boundaryml/baml@${generatedVersion}
$ yarn add @boundaryml/baml@${generatedVersion}
$ pnpm add @boundaryml/baml@${generatedVersion}

If nothing else works, please ask for help:

https://github.com/boundaryml/baml/issues
https://boundaryml.com/discord`;
        throw new Error(errorMessage.trim());
    }
}

View on GitHub (pinned to bd85ce9dee)

Solutions

  1. Run the printed command: `npm install @boundaryml/baml@<generatedVersion>` (or yarn/pnpm equivalent).
  2. Re-run `baml generate` after upgrading so versions agree.
  3. Add a postinstall/CI check that versions match, or pin the CLI and package to the same version.

Example fix

// shell
// before (generatedVersion 0.80.0, installed 0.77.0)
# npm i
// after
# npm install @boundaryml/baml@0.80.0 && baml generate
Defensive patterns

Strategy: validation

Validate before calling

// scripts/check-baml-version.mjs
import generated from './generated_code/version.json' with { type: 'json' };
import pkg from './node_modules/@boundaryml/baml/package.json' with { type: 'json' };
if (pkg.version !== generated.version) throw new Error(`baml version mismatch: runtime ${pkg.version} vs generated ${generated.version}`);

Try / catch

try {
  const b = require('./generated_code');
} catch (e) {
  if (String(e.message).includes('Update to @boundaryml/baml required')) {
    console.error('Run: npm install @boundaryml/baml@<version from generators.baml>, then baml generate');
  }
  throw e;
}

Prevention

When it happens

Trigger: Importing generated_code (e.g. b.baml or index.ts) after `baml generate` bumped the required version, while package.json still pins an older @boundaryml/baml; OR a runtime newer than the generator version.

Common situations: Upgrading the BAML CLI and re-generating without running npm install; teammates pulling generated files but a stale lockfile; CI caching an old node_modules; mixed versions across a monorepo.

Related errors


AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12). Data as JSON: /api/errors/aca6fa61f139639a. Report an issue: GitHub.