{"record":{"id":"45e997be97b956ee","repo":"diegosouzapw/OmniRoute","slug":"memory-does-not-belong-to-this-api-key","errorCode":null,"errorMessage":"Memory does not belong to this API key","messagePattern":"Memory does not belong to this API key","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/lib/skills/memoryBuiltins.ts","lineNumber":39,"sourceCode":"const MEMORY_TYPES = [\"factual\", \"episodic\", \"procedural\", \"semantic\"] as const;\n\nfunction toMemoryType(value: unknown): MemoryType {\n  return MEMORY_TYPES.includes(value as (typeof MEMORY_TYPES)[number])\n    ? (value as MemoryType)\n    : MemoryType.FACTUAL;\n}\n\nfunction toPositiveInt(value: unknown, fallback: number, max: number): number {\n  const parsed = Number(value);\n  if (!Number.isInteger(parsed) || parsed <= 0) return fallback;\n  return Math.min(parsed, max);\n}\n\nasync function assertOwner(memoryId: string, apiKeyId: string): Promise<void> {\n  const memory = await getMemory(memoryId);\n  if (!memory) throw new Error(`Memory not found: ${memoryId}`);\n  if (memory.apiKeyId !== apiKeyId) {\n    throw new Error(\"Memory does not belong to this API key\");\n  }\n}\n\nfunction memoryToPlain(memory: Awaited<ReturnType<typeof createMemory>>) {\n  return {\n    id: memory.id,\n    type: memory.type,\n    key: memory.key,\n    content: memory.content,\n    metadata: memory.metadata,\n    createdAt: memory.createdAt.toISOString(),\n    updatedAt: memory.updatedAt.toISOString(),\n  };\n}\n\nasync function handleMemorySave(input: Record<string, unknown>, context: { apiKeyId: string; sessionId: string }) {\n  const { type, key, content, metadata } = input as {\n    type?: string;","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/skills/memoryBuiltins.ts#L21-L57","documentation":"Error \"Memory does not belong to this API key\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at src/lib/skills/memoryBuiltins.ts:39 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","schemaVersion":2},"datasetVersion":"2026-08-25T21:54:21.419Z"}