JuliusBrussee/caveman · error

cave_memory_provenance_unsupported

cave_memory_provenance_unsupported

Error message

cave_memory_provenance_unsupported: only "local" memory is supported

What it means

The memory() primitive only supports single-tenant, local memory storage, so options.provenance must be "local" (the default when omitted). Passing "project" or "external" requests a shared-backend contract this package does not implement. The check is deliberately done at construction time rather than at tool-call time so a model turn is not wasted discovering an unsupported configuration.

Solutions

  1. Remove the provenance option entirely — "local" is the default and the only supported value
  2. Set provenance: "local" explicitly if the config is generated from a template
  3. If shared/project memory is required, use the package/backend that implements that provenance contract instead of this one
  4. Fix string casing/typos so the value is exactly "local"

Example fix

// before
defineMemory({ namespace: "notes", ttl: "7d", provenance: "project" });
// after
defineMemory({ namespace: "notes", ttl: "7d" }); // provenance defaults to "local"
Defensive patterns

Strategy: validation

Validate before calling

function isSupportedProvenance(p) {
  return p === undefined || p === "local";
}
// before calling: if (!isSupportedProvenance(provenance)) throw new Error(`unsupported provenance: ${provenance}`);

Type guard

function isLocalProvenance(p: unknown): p is "local" | undefined {
  return p === undefined || p === "local";
}

Try / catch

try {
  const def = memory({ namespace: "notes", provenance });
} catch (err) {
  if (err instanceof Error && err.message.includes("cave_memory_provenance_unsupported")) {
    console.error(`Provenance ${JSON.stringify(provenance)} unsupported here; only "local" (default) is available`);
    return;
  }
  throw err;
}

Prevention

When it happens

Trigger: Calling memory() with provenance: "project" or provenance: "external" in the options object. Any non-"local" string (including typos like "Local" or "locol") also trips the strict !== "local" comparison.

Common situations: Porting a memory definition from an edition or package that supports shared/project backends into this local-only package; copying options from a team template configured for shared storage; a typo in the provenance string.

Related errors


AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20). Data as JSON: /api/errors/606203f5593e31f4. Report an issue: GitHub.

Appendix: source

Thrown at packages/agent/src/primitives.ts:286

  if (!/^[a-z0-9][a-z0-9_-]{0,95}$/.test(options.namespace)) {
    throw new Error(`caveman agent: invalid memory namespace ${JSON.stringify(options.namespace)}`);
  }
  if (!Number.isSafeInteger(options.recallBudget) || options.recallBudget < 0) {
    throw new Error("caveman agent: memory recallBudget must be a non-negative integer");
  }
  try {
    memoryTTLMilliseconds(options.ttl);
  } catch {
    throw new Error("caveman agent: memory ttl must use positive m, h, or d duration");
  }
  // Fail closed at CONSTRUCTION, not at tool-call time: the durable
  // store implements only local, single-tenant memory. A `project`/`external`
  // provenance or a `project_shared` consent is a shared-backend contract this
  // package does not provide, so it is refused here rather than burning a model
  // turn to discover a config the framework already knew was unsupported.
  const provenance = options.provenance ?? "local";
  if (provenance !== "local") {
    throw new Error("cave_memory_provenance_unsupported: only \"local\" memory is supported");
  }
  const consent = options.consent ?? "local_only";
  if (consent !== "local_only") {
    throw new Error("cave_memory_consent_unsupported: only \"local_only\" consent is supported");
  }
  return Object.freeze({
    kind: "memory",
    namespace: options.namespace,
    provenance,
    ttl: options.ttl,
    recallBudget: options.recallBudget,
    consent,
  });
}

export type ContextKind =
  | "instruction"
  | "user_intent"

View on GitHub (pinned to 3ee70a1026)