JuliusBrussee/caveman · error · Error
cave_${harness}_upstream_version_mismatch
cave_${harness}_upstream_version_mismatch
Error message
cave_${harness}_upstream_version_mismatch What it means
The installed package matches the exact pin, but the upstreamVersion string in the HarnessAdapterIdentity you passed to the factory does not equal the installed version. The pin is enforced against what is actually installed and the caller's claim must match it — a claim alone can no longer authorize execution.
Solutions
- Build identity.upstreamVersion from the exported constants (VERCEL_AI_SDK_VERSION, EVE_VERSION, MASTRA_VERSION) instead of typing it
- Or read the installed version at startup from the package's own package.json and feed that into the identity
- Keep a single source of truth for the pin and fail CI when package.json disagrees with it
Example fix
// before
const identity = { adapterVersion: "1.0.0", upstreamVersion: "7.0.42", ... };
const adapter = createVercelAISDKAdapter(identity, agent); // throws cave_vercel_upstream_version_mismatch
// after
import { VERCEL_AI_SDK_VERSION } from "@caveman-ai/agent";
const identity = { adapterVersion: "1.0.0", upstreamVersion: VERCEL_AI_SDK_VERSION, ... }; Defensive patterns
Strategy: validation
Validate before calling
// Derive the identity's claim from the same source as the pin.
import { VERCEL_AI_SDK_VERSION } from "@caveman-ai/agent";
const identity = {
adapterVersion: pkg.version,
upstreamVersion: VERCEL_AI_SDK_VERSION, // never hand-typed
/* ... */
}; Try / catch
try {
const adapter = createMastraAdapter(identity, agent, opts);
} catch (error) {
if (error instanceof Error && error.message.endsWith("_upstream_version_mismatch")) {
// identity.upstreamVersion disagrees with the installed pin;
// rebuild the identity from the exported version constant.
}
throw error;
} Prevention
- Build HarnessAdapterIdentity.upstreamVersion from the exported constants at runtime
- Never persist identity objects across dependency upgrades
- Treat version strings as code: update them in the same commit as package.json
When it happens
Trigger: Passing identity.upstreamVersion "7.0.42" (or a hand-typed/README-copied string) to createVercelAISDKAdapter while ai@7.0.43 is installed; reusing an identity object recorded from an older build; generating identity from a config value that drifted from package.json.
Common situations: Hardcoding the version in two places (identity and package.json) and updating only one; CI caching identity snapshots; a deploy template with a stale version string.
Related errors
- cave_${harness}_upstream_version_unresolvable
- cave_${harness}_upstream_version_unsupported
- cave_harness_model_identity_missing
- cave_harness_model_invalid
- cave_harness_transform_not_evaluated
AI-assisted analysis of JuliusBrussee/caveman@766dce6b13 (2026-08-18).
Data as JSON: /api/errors/8d361ec6b7ae39e8.
Report an issue: GitHub.
Appendix: source
Thrown at packages/agent/src/adapters.ts:592
function assertSupportedUpstream(
identity: HarnessAdapterIdentity,
expected: string,
harness: string,
pkg: string,
): void {
// The pin is enforced against the INSTALLED version, and the caller's claimed
// upstreamVersion must match what is actually installed — a claim alone can no
// longer authorize execution.
const installed = installedPackageVersion(pkg);
if (installed === undefined) {
throw new Error(`cave_${harness}_upstream_version_unresolvable`);
}
if (installed !== expected) {
throw new Error(`cave_${harness}_upstream_version_unsupported`);
}
if (identity.upstreamVersion !== installed) {
throw new Error(`cave_${harness}_upstream_version_mismatch`);
}
}
function canonicalRecord(value: Readonly<Record<string, unknown>>): Readonly<Record<string, unknown>> {
let encoded: string;
try {
encoded = stableStringify(value);
} catch {
throw new Error("cave_harness_wire_contract_invalid");
}
const decoded = JSON.parse(encoded) as unknown;
if (!isRecord(decoded)) throw new Error("cave_harness_wire_contract_invalid");
return decoded;
}
function deepFreeze<T>(value: T): T {
if (value !== null && typeof value === "object") {
Object.freeze(value);View on GitHub (pinned to 766dce6b13)