{"record":{"id":"606203f5593e31f4","repo":"JuliusBrussee/caveman","slug":"cave-memory-provenance-unsupported","errorCode":"cave_memory_provenance_unsupported","errorMessage":"cave_memory_provenance_unsupported: only \"local\" memory is supported","messagePattern":"cave_memory_provenance_unsupported: only \"local\" memory is supported","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/agent/src/primitives.ts","lineNumber":286,"sourceCode":"  if (!/^[a-z0-9][a-z0-9_-]{0,95}$/.test(options.namespace)) {\n    throw new Error(`caveman agent: invalid memory namespace ${JSON.stringify(options.namespace)}`);\n  }\n  if (!Number.isSafeInteger(options.recallBudget) || options.recallBudget < 0) {\n    throw new Error(\"caveman agent: memory recallBudget must be a non-negative integer\");\n  }\n  try {\n    memoryTTLMilliseconds(options.ttl);\n  } catch {\n    throw new Error(\"caveman agent: memory ttl must use positive m, h, or d duration\");\n  }\n  // Fail closed at CONSTRUCTION, not at tool-call time: the durable\n  // store implements only local, single-tenant memory. A `project`/`external`\n  // provenance or a `project_shared` consent is a shared-backend contract this\n  // package does not provide, so it is refused here rather than burning a model\n  // turn to discover a config the framework already knew was unsupported.\n  const provenance = options.provenance ?? \"local\";\n  if (provenance !== \"local\") {\n    throw new Error(\"cave_memory_provenance_unsupported: only \\\"local\\\" memory is supported\");\n  }\n  const consent = options.consent ?? \"local_only\";\n  if (consent !== \"local_only\") {\n    throw new Error(\"cave_memory_consent_unsupported: only \\\"local_only\\\" consent is supported\");\n  }\n  return Object.freeze({\n    kind: \"memory\",\n    namespace: options.namespace,\n    provenance,\n    ttl: options.ttl,\n    recallBudget: options.recallBudget,\n    consent,\n  });\n}\n\nexport type ContextKind =\n  | \"instruction\"\n  | \"user_intent\"","sourceCodeStart":268,"sourceCodeEnd":304,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/packages/agent/src/primitives.ts#L268-L304","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Remove the provenance option entirely — \"local\" is the default and the only supported value","Set provenance: \"local\" explicitly if the config is generated from a template","If shared/project memory is required, use the package/backend that implements that provenance contract instead of this one","Fix string casing/typos so the value is exactly \"local\""],"exampleFix":"// before\ndefineMemory({ namespace: \"notes\", ttl: \"7d\", provenance: \"project\" });\n// after\ndefineMemory({ namespace: \"notes\", ttl: \"7d\" }); // provenance defaults to \"local\"","handlingStrategy":"validation","validationCode":"function isSupportedProvenance(p) {\n  return p === undefined || p === \"local\";\n}\n// before calling: if (!isSupportedProvenance(provenance)) throw new Error(`unsupported provenance: ${provenance}`);","typeGuard":"function isLocalProvenance(p: unknown): p is \"local\" | undefined {\n  return p === undefined || p === \"local\";\n}","tryCatchPattern":"try {\n  const def = memory({ namespace: \"notes\", provenance });\n} catch (err) {\n  if (err instanceof Error && err.message.includes(\"cave_memory_provenance_unsupported\")) {\n    console.error(`Provenance ${JSON.stringify(provenance)} unsupported here; only \"local\" (default) is available`);\n    return;\n  }\n  throw err;\n}","preventionTips":["Omit provenance unless you know you need it — \"local\" is the only supported value","Strip shared-backend options when porting definitions between packages","Use a typed options object typed to 'local' | undefined so other values fail at compile time","Document in shared templates that this package is local-only"],"tags":["unsupported-feature","configuration","memory","provenance"],"backgroundTag":"unsupported-enum-value","analyzedSha":"3ee70a102609e550bd2e68004bf5990a9341c851","analyzedAt":"2026-09-20T15:53:39.229Z","contentChangedAt":"2026-09-20T15:53:39.229Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}