JuliusBrussee/caveman · error · Error
cave_${harness}_upstream_version_unresolvable
cave_${harness}_upstream_version_unresolvable
Error message
cave_${harness}_upstream_version_unresolvable What it means
assertSupportedUpstream resolves the pinned package ('ai', 'eve', or '@mastra/core') via import.meta.resolve and reads its installed package.json version. cave_${harness}_upstream_version_unresolvable means installedPackageVersion returned undefined: the adapter could not determine what is installed at all, so it refuses to construct because an unresolvable version cannot be verified against the pin.
Solutions
- Install the pinned package as a real dependency: ai@7.0.43, eve@0.29.2, or @mastra/core@1.55.0
- Run under real Node ESM — do not bundle import.meta.resolve; keep the adapter code unbundled or mark the pinned packages external
- Verify in the same process that import.meta.resolve('ai/package.json') (or the package entry) resolves before constructing the adapter
Example fix
# before npm install ai # installs 7.x latest, or not at all with --omit=peer # after npm install ai@7.0.43 --save-exact
Defensive patterns
Strategy: validation
Validate before calling
// Preflight: replicate the adapter's resolution before constructing it.
import { createRequire } from "node:module";
function packageResolvable(pkg: string): boolean {
try {
const path = createRequire(import.meta.url).resolve(`${pkg}/package.json`);
return JSON.parse(readFileSync(path, "utf8")).version !== undefined;
} catch {
return false;
}
}
if (!packageResolvable("ai")) throw new Error("pinned package 'ai' not resolvable"); Try / catch
try {
const adapter = createVercelAISDKAdapter(identity, agent);
} catch (error) {
if (error instanceof Error && error.message.endsWith("_upstream_version_unresolvable")) {
// The pinned package could not be resolved from this process;
// install it exactly, and avoid bundling import.meta.resolve away.
}
throw error;
} Prevention
- Install the pinned package as a direct exact dependency of the integrating package
- Keep adapter code running under real Node ESM; mark pinned packages external in bundlers
- Run the framework's doctor command before execution to catch missing upstream readiness
When it happens
Trigger: Calling createVercelAISDKAdapter/createEveAdapter/createMastraAdapter when the pinned package is not installed (peer dep skipped), when import.meta.resolve fails or is shimmed away by a bundler, when the package's exports map hides package.json and the entry-walk fallback also fails, or when node_modules is corrupted.
Common situations: Installing with peer dependencies omitted or pruned; running the adapter inside an esbuild/webpack/serverless bundle where import.meta.resolve throws or returns a bundled URL; pnpm strict layouts where the upstream package is not a dependency of the integrating package.
Related errors
- cave_${harness}_upstream_version_mismatch
- 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/b9efa74dbd69e8e9.
Report an issue: GitHub.
Appendix: source
Thrown at packages/agent/src/adapters.ts:586
}
} catch {
// Not resolvable at all.
}
return undefined;
}
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");View on GitHub (pinned to 766dce6b13)