{"record":{"id":"aca6fa61f139639a","repo":"BoundaryML/baml","slug":"update-to-boundaryml-baml-required-version-from-generators","errorCode":null,"errorMessage":"Update to @boundaryml/baml required.\nVersion from generators.baml: ${generatedVersion}\nCurrent @boundaryml/baml version: ${runtimeVersion}\n\nPlease upgrade @boundaryml/baml to version ${generatedVersion}.\n\n$ npm install @boundaryml/baml@${generatedVersion}\n$ yarn add @boundaryml/baml@${generatedVersion}\n$ pnpm add @boundaryml/baml@${generatedVersion}\n\nIf nothing else works, please ask for help:\n\nhttps://github.com/boundaryml/baml/issues\nhttps://boundaryml.com/discord","messagePattern":"Update to @boundaryml/baml required\\.\nVersion from generators\\.baml: (.+?)\nCurrent @boundaryml/baml version: (.+?)\n\nPlease upgrade @boundaryml/baml to version (.+?)\\.\n\n\\$ npm install @boundaryml/baml@(.+?)\n\\$ yarn add @boundaryml/baml@(.+?)\n\\$ pnpm add @boundaryml/baml@(.+?)\n\nIf nothing else works, please ask for help:\n\nhttps://github\\.com/boundaryml/baml/issues\nhttps://boundaryml\\.com/discord","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"engine/language_client_typescript/safe_imports.js","lineNumber":32,"sourceCode":"}\nfunction ThrowIfVersionMismatch(generatedVersion) {\n    const runtimeVersion = (0, native_1.get_version)();\n    if (!ensureVersionCompatibility(generatedVersion, runtimeVersion)) {\n        const errorMessage = `Update to @boundaryml/baml required.\nVersion from generators.baml: ${generatedVersion}\nCurrent @boundaryml/baml version: ${runtimeVersion}\n\nPlease upgrade @boundaryml/baml to version ${generatedVersion}.\n\n$ npm install @boundaryml/baml@${generatedVersion}\n$ yarn add @boundaryml/baml@${generatedVersion}\n$ pnpm add @boundaryml/baml@${generatedVersion}\n\nIf nothing else works, please ask for help:\n\nhttps://github.com/boundaryml/baml/issues\nhttps://boundaryml.com/discord`;\n        throw new Error(errorMessage.trim());\n    }\n}\n","sourceCodeStart":14,"sourceCodeEnd":35,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/language_client_typescript/safe_imports.js#L14-L35","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Run the printed command: `npm install @boundaryml/baml@<generatedVersion>` (or yarn/pnpm equivalent).","Re-run `baml generate` after upgrading so versions agree.","Add a postinstall/CI check that versions match, or pin the CLI and package to the same version."],"exampleFix":"// shell\n// before (generatedVersion 0.80.0, installed 0.77.0)\n# npm i\n// after\n# npm install @boundaryml/baml@0.80.0 && baml generate","handlingStrategy":"validation","validationCode":"// scripts/check-baml-version.mjs\nimport generated from './generated_code/version.json' with { type: 'json' };\nimport pkg from './node_modules/@boundaryml/baml/package.json' with { type: 'json' };\nif (pkg.version !== generated.version) throw new Error(`baml version mismatch: runtime ${pkg.version} vs generated ${generated.version}`);","typeGuard":null,"tryCatchPattern":"try {\n  const b = require('./generated_code');\n} catch (e) {\n  if (String(e.message).includes('Update to @boundaryml/baml required')) {\n    console.error('Run: npm install @boundaryml/baml@<version from generators.baml>, then baml generate');\n  }\n  throw e;\n}","preventionTips":["After every `baml generate`, run npm/yarn/pnpm install so the runtime matches.","Pin the BAML CLI and @boundaryml/baml to the same version in package.json.","Add a CI step comparing the generator version with the installed package."],"tags":["typescript","version-mismatch","code-generation","installation"],"backgroundTag":"version-incompatible","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"}