{"record":{"id":"658815a6b8da6fe9","repo":"clockworklabs/SpacetimeDB","slug":"module-code-was-generated-with-an-incompatible-ver","errorCode":null,"errorMessage":"Module code was generated with an incompatible version of the spacetimedb cli (${incompatibleVersion}). Update the cli version to at least ${_MINIMUM_CLI_VERSION.toString()} and regenerate the bindings. You can upgrade to the latest cli version by running: spacetime version upgrade","messagePattern":"Module code was generated with an incompatible version of the spacetimedb cli \\((.+?)\\)\\. Update the cli version to at least (.+?) and regenerate the bindings\\. You can upgrade to the latest cli version by running: spacetime version upgrade","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"crates/bindings-typescript/src/sdk/version.ts","lineNumber":123,"sourceCode":"    const preRelease = match[4]\n      ? match[4].split('.').map(id => (isNaN(Number(id)) ? id : Number(id)))\n      : null;\n    const buildInfo = match[5] || null;\n\n    return new SemanticVersion(major, minor, patch, preRelease, buildInfo);\n  }\n}\n\n// The SDK depends on some module information that was not generated before this version.\nexport const _MINIMUM_CLI_VERSION: SemanticVersion = new SemanticVersion(\n  1,\n  4,\n  0\n);\n\nexport function ensureMinimumVersionOrThrow(versionString?: string): void {\n  if (versionString === undefined) {\n    throw new Error(versionErrorMessage(versionString));\n  }\n  const version = SemanticVersion.parseVersionString(versionString);\n  if (version.compare(_MINIMUM_CLI_VERSION) < 0) {\n    throw new Error(versionErrorMessage(versionString));\n  }\n}\n\nfunction versionErrorMessage(incompatibleVersion?: string): string {\n  return `Module code was generated with an incompatible version of the spacetimedb cli (${incompatibleVersion}). Update the cli version to at least ${_MINIMUM_CLI_VERSION.toString()} and regenerate the bindings. You can upgrade to the latest cli version by running: spacetime version upgrade`;\n}\n","sourceCodeStart":105,"sourceCodeEnd":134,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/524b4487d949b61a07d4f39c862d1290259dfd20/crates/bindings-typescript/src/sdk/version.ts#L105-L134","documentation":"ensureMinimumVersionOrThrow runs during DbConnection.builder().build() and checks the generated module metadata versionInfo.cliVersion. This branch fires when the value is undefined: the bindings were generated by a spacetimedb CLI older than 1.4.0, which did not emit the module information this SDK depends on, so the SDK refuses to connect. The interpolated version in the message renders as 'undefined'.","triggerScenarios":"Calling .build() with TypeScript bindings generated by spacetimedb CLI < 1.4.0 (no versionInfo in the generated remote module), or with a hand-rolled RemoteModule that omits versionInfo.","commonSituations":"Upgraded the SDK package but not the CLI; CI or a teammate regenerating bindings with an old CLI from PATH; cached/committed generated bindings from before the upgrade.","solutions":["Upgrade the CLI (>= 1.4.0): `spacetime version upgrade`, then regenerate the TypeScript bindings","Delete stale generated binding files/directories and re-run generation from scratch","Pin the CLI version in CI so every regeneration uses a compatible toolchain"],"exampleFix":"# before (bindings generated with old cli)\nspacetime generate --lang typescript --out-dir src/module\n\n# after\nspacetime version upgrade\nspacetime generate --lang typescript --out-dir src/module","handlingStrategy":"validation","validationCode":"import { SemanticVersion, _MINIMUM_CLI_VERSION } from './version';\nconst cliVersion = remoteModule.versionInfo?.cliVersion;\nif (!cliVersion) {\n  throw new Error('Bindings are pre-1.4.0 (no cliVersion). Regenerate with spacetimedb CLI >= 1.4.0');\n}\nif (SemanticVersion.parseVersionString(cliVersion).compare(_MINIMUM_CLI_VERSION) < 0) {\n  throw new Error(`Bindings from CLI ${cliVersion}; need >= ${_MINIMUM_CLI_VERSION.toString()}`);\n}","typeGuard":"function bindingsHaveVersionInfo(mod: { versionInfo?: { cliVersion?: string } }): boolean {\n  return typeof mod.versionInfo?.cliVersion === 'string';\n}","tryCatchPattern":null,"preventionTips":["Regenerate bindings whenever you upgrade the SDK package","Check `spacetime version` in CI and fail the build below 1.4.0","Treat versionInfo as required metadata; do not hand-roll RemoteModules without it"],"tags":["versioning","cli","bindings","compatibility","typescript"],"backgroundTag":"sdk-version-mismatch","analyzedSha":"524b4487d949b61a07d4f39c862d1290259dfd20","analyzedAt":"2026-08-16T23:58:54.611Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}