{"record":{"id":"fa576ac61f82cbde","repo":"JuliusBrussee/caveman","slug":"cave-memory-shared-backend-unavailable","errorCode":null,"errorMessage":"cave_memory_shared_backend_unavailable","messagePattern":"cave_memory_shared_backend_unavailable","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/agent/src/runtime.ts","lineNumber":3116,"sourceCode":"    },\n  };\n}\n\nfunction validEngineTokenCount(value: unknown): number | undefined {\n  return Number.isSafeInteger(value) && Number(value) >= 0 ? Number(value) : undefined;\n}\n\nfunction localMemoryTools(\n  definition: NonNullable<AgentDefinition[\"memory\"]>,\n  agentId: string,\n  config: MemoryStoreConfig | undefined,\n): AgentTool<TSchema>[] {\n  // Defense in depth: memory() already rejects a non-local provenance/consent at\n  // construction, but a hand-built MemoryDefinition must still fail\n  // BEFORE the run spends — not inside a tool call — so this throws at tool\n  // setup, never at execute time.\n  if (definition.provenance !== \"local\" || definition.consent !== \"local_only\") {\n    throw new Error(\"cave_memory_shared_backend_unavailable\");\n  }\n  // Resolved once so a validation failure surfaces at setup, and every entry is\n  // scoped by (tenant, agentId, namespace): two AgentDefinitions declaring the\n  // same namespace in one process write to different files and never bleed.\n  const filePath = memoryFilePath(config, agentId, definition.namespace);\n  const ttl = memoryTTLMilliseconds(definition.ttl);\n  const recall: AgentTool<TSchema> = {\n    name: \"cave_memory_search\",\n    label: \"cave_memory_search\",\n    description: \"Recall relevant local memory from declared namespace. Returns bounded local evidence only.\",\n    parameters: Type.Object({ query: Type.String() }),\n    executionMode: \"parallel\",\n    async execute(_toolCallId, params) {\n      const query = (params as { query: string }).query;\n      const now = Date.now();\n      // Eviction on read: a memory past its declared ttl is neither returned nor\n      // kept — the durable set is rewritten with only the live entries.\n      const live = await mutateMemories(filePath, (entries) =>","sourceCodeStart":3098,"sourceCodeEnd":3134,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/packages/agent/src/runtime.ts#L3098-L3134","documentation":"Error \"cave_memory_shared_backend_unavailable\" thrown in JuliusBrussee/caveman.","triggerScenarios":"Thrown at packages/agent/src/runtime.ts:3116 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Shared memory backend is not configured; use local memory or configure a shared backend."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"27d5a3981a347890211bb1bf2439e5c821a63bc9","analyzedAt":"2026-08-15T09:26:11.751Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}