{"record":{"id":"395332f111d5e0c3","repo":"JuliusBrussee/caveman","slug":"cave-memory-value-invalid","errorCode":null,"errorMessage":"cave_memory_value_invalid","messagePattern":"cave_memory_value_invalid","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/agent/src/runtime.ts","lineNumber":3166,"sourceCode":"        if (used + item.entry.text.length > maxChars) continue;\n        hits.push(item.entry.text);\n        used += item.entry.text.length;\n      }\n      return {\n        content: [{ type: \"text\", text: JSON.stringify({ hits, basis: \"inferred\", namespace: definition.namespace }) }],\n        details: { namespace: definition.namespace, recallTokensEstimated: Math.ceil(used / 4) },\n      };\n    },\n  };\n  const remember: AgentTool<TSchema> = {\n    name: \"cave_memory_remember\",\n    label: \"cave_memory_remember\",\n    description: \"Remember one explicit fact in declared local namespace.\",\n    parameters: Type.Object({ text: Type.String() }),\n    executionMode: \"sequential\",\n    async execute(_toolCallId, params) {\n      const text = (params as { text: string }).text.trim();\n      if (text.length === 0 || text.length > 8_192) throw new Error(\"cave_memory_value_invalid\");\n      await mutateMemories(filePath, (entries) => {\n        const next: MemoryEntry[] = entries.some((entry) => entry.text === text)\n          ? entries\n          : [...entries, { text, createdAt: Date.now() }];\n        return next.length > 1_000 ? next.slice(next.length - 1_000) : next;\n      });\n      return {\n        content: [{ type: \"text\", text: JSON.stringify({ remembered: true, basis: \"inferred\" }) }],\n        details: { namespace: definition.namespace },\n      };\n    },\n  };\n  return [recall, remember];\n}\n\nfunction tokenize(value: string): string[] {\n  return value.toLowerCase().match(/[a-z0-9]{2,}/g) ?? [];\n}","sourceCodeStart":3148,"sourceCodeEnd":3184,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/packages/agent/src/runtime.ts#L3148-L3184","documentation":"Error \"cave_memory_value_invalid\" thrown in JuliusBrussee/caveman.","triggerScenarios":"Thrown at packages/agent/src/runtime.ts:3166 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Store a valid memory value: a non-empty string within the configured size limits."],"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"}