{"record":{"id":"9d90b70f70e14f28","repo":"JuliusBrussee/caveman","slug":"cave-memory-provenance-unsupported-only-local-m","errorCode":null,"errorMessage":"cave_memory_provenance_unsupported: only \"local\" memory is supported","messagePattern":"cave_memory_provenance_unsupported: only \"local\" memory is supported","errorType":"validation","errorClass":"Error","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/27d5a3981a347890211bb1bf2439e5c821a63bc9/packages/agent/src/primitives.ts#L268-L304","documentation":"The durable memory store in this package implements only local, single-tenant memory, so memory() fails closed at construction when provenance is 'project' or 'external'. Passing anything other than the default 'local' throws rather than waiting until tool-call time, because a shared-backend contract the framework does not provide should be rejected before a model turn is spent discovering it.","triggerScenarios":"Calling memory({ provenance: 'project' }) or memory({ provenance: 'external' }). The option type admits the strings, but the only supported value (and the default when omitted) is 'local'.","commonSituations":"Copying a memory definition from a spec or another framework that supports project-shared or external provenance; writing config ahead of a feature that does not exist in this version; the type union inviting experimentation with 'project'.","solutions":["Drop the provenance option (it defaults to 'local') or set it explicitly to 'local'","If you need shared/team memory, keep it out of this primitive — back it with your own tool or store until the framework supports it","Strip unsupported provenance values when loading config so a stale config key cannot break construction"],"exampleFix":"// before\nmemory({ namespace: 'notes', ttl: '7d', recallBudget: 10, provenance: 'project' });\n\n// after\nmemory({ namespace: 'notes', ttl: '7d', recallBudget: 10, provenance: 'local' });","handlingStrategy":"validation","validationCode":"const SUPPORTED_PROVENANCE = new Set(['local']);\nfunction checkProvenance(p: unknown): 'local' | undefined {\n  if (p === undefined) return undefined;\n  if (!SUPPORTED_PROVENANCE.has(p as string)) throw new Error('only provenance \"local\" is supported by this build');\n  return 'local';\n}","typeGuard":"function isSupportedProvenance(value: unknown): value is 'local' { return value === 'local' || value === undefined; }","tryCatchPattern":"try { memory(opts); } catch (e) { if (e instanceof Error && e.message.startsWith('cave_memory_provenance_unsupported')) throw new ConfigError('shared memory provenance is not available; use local', { cause: e }); throw e; }","preventionTips":["Omit provenance unless you need to be explicit","Treat the wider type union as future API, not current API","Strip provenance from persisted configs when the framework rejects it"],"tags":["memory","provenance","unsupported-feature","fail-closed"],"backgroundTag":null,"analyzedSha":"27d5a3981a347890211bb1bf2439e5c821a63bc9","analyzedAt":"2026-08-15T09:26:11.751Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}