{"record":{"id":"bb9ef81069920448","repo":"JuliusBrussee/caveman","slug":"cave-harness-upstream-version-unsupported","errorCode":"cave_${harness}_upstream_version_unsupported","errorMessage":"cave_${harness}_upstream_version_unsupported","messagePattern":"cave_(.+?)_upstream_version_unsupported","errorType":"error_code","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/agent/src/adapters.ts","lineNumber":589,"sourceCode":"  }\n  return undefined;\n}\n\nfunction assertSupportedUpstream(\n  identity: HarnessAdapterIdentity,\n  expected: string,\n  harness: string,\n  pkg: string,\n): void {\n  // The pin is enforced against the INSTALLED version, and the caller's claimed\n  // upstreamVersion must match what is actually installed — a claim alone can no\n  // longer authorize execution.\n  const installed = installedPackageVersion(pkg);\n  if (installed === undefined) {\n    throw new Error(`cave_${harness}_upstream_version_unresolvable`);\n  }\n  if (installed !== expected) {\n    throw new Error(`cave_${harness}_upstream_version_unsupported`);\n  }\n  if (identity.upstreamVersion !== installed) {\n    throw new Error(`cave_${harness}_upstream_version_mismatch`);\n  }\n}\n\nfunction canonicalRecord(value: Readonly<Record<string, unknown>>): Readonly<Record<string, unknown>> {\n  let encoded: string;\n  try {\n    encoded = stableStringify(value);\n  } catch {\n    throw new Error(\"cave_harness_wire_contract_invalid\");\n  }\n  const decoded = JSON.parse(encoded) as unknown;\n  if (!isRecord(decoded)) throw new Error(\"cave_harness_wire_contract_invalid\");\n  return decoded;\n}\n","sourceCodeStart":571,"sourceCodeEnd":607,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/766dce6b1394ebb56a3090748d5a0240a5aefb36/packages/agent/src/adapters.ts#L571-L607","documentation":"The installed version of the pinned upstream was resolved but differs from the exact pin the adapter enforces (Vercel AI SDK 7.0.43, Eve 0.29.2, Mastra 1.55.0 — exported constants in adapters.ts). The adapter executes only against the exact-pinned version, so any other installed version is rejected at adapter construction.","triggerScenarios":"createVercelAISDKAdapter/createEveAdapter/createMastraAdapter while node_modules contains ai != 7.0.43, eve != 0.29.2, or @mastra/core != 1.55.0 — e.g. a caret/tilde range resolved to a newer minor, a lockfile regenerated, or a transitive dependency bumped the package.","commonSituations":"\"ai\": \"^7.0.0\" in package.json drifting to 7.0.44+; a fresh install after a new upstream release; another package in the workspace forcing a different @mastra/core.","solutions":["Pin the exact version in dependencies: ai@7.0.43 / eve@0.29.2 / @mastra/core@1.55.0 and reinstall from a clean lockfile","Add a package.json override so no transitive path can bump the pinned package","Re-run install and verify with npm ls ai (or eve / @mastra/core) that a single exact version resolves"],"exampleFix":"// package.json — before\n\"dependencies\": { \"ai\": \"^7.0.0\" }\n\n// after\n\"dependencies\": { \"ai\": \"7.0.43\" }","handlingStrategy":"validation","validationCode":"// Before constructing the adapter, compare installed vs pinned versions.\nimport { createRequire } from \"node:module\";\nfunction installedVersion(pkg: string): string | undefined {\n  try {\n    const path = createRequire(import.meta.url).resolve(`${pkg}/package.json`);\n    return JSON.parse(readFileSync(path, \"utf8\")).version;\n  } catch {\n    return undefined;\n  }\n}\nif (installedVersion(\"ai\") !== VERCEL_AI_SDK_VERSION) {\n  throw new Error(`install ai@${VERCEL_AI_SDK_VERSION} exactly`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  const adapter = createEveAdapter(identity, session);\n} catch (error) {\n  if (error instanceof Error && error.message.endsWith(\"_upstream_version_unsupported\")) {\n    // Installed upstream differs from the exact pin; reinstall the pinned\n    // version and rebuild the lockfile before retrying.\n  }\n  throw error;\n}","preventionTips":["Pin exact versions (no carets) for ai, eve, and @mastra/core","Add package.json overrides so transitive deps cannot bump the pinned package","Fail CI when npm ls shows any version other than the pin"],"tags":["dependency","version-pin","adapter","npm"],"backgroundTag":"dependency-version-mismatch","analyzedSha":"766dce6b1394ebb56a3090748d5a0240a5aefb36","analyzedAt":"2026-08-18T03:14:35.516Z","contentChangedAt":"2026-08-18T03:14:35.516Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}