diegosouzapw/OmniRoute · error

Memory does not belong to this API key

Error message

Memory does not belong to this API key

What it means

Error "Memory does not belong to this API key" thrown in diegosouzapw/OmniRoute.

Source

Thrown at src/lib/skills/memoryBuiltins.ts:39

const MEMORY_TYPES = ["factual", "episodic", "procedural", "semantic"] as const;

function toMemoryType(value: unknown): MemoryType {
  return MEMORY_TYPES.includes(value as (typeof MEMORY_TYPES)[number])
    ? (value as MemoryType)
    : MemoryType.FACTUAL;
}

function toPositiveInt(value: unknown, fallback: number, max: number): number {
  const parsed = Number(value);
  if (!Number.isInteger(parsed) || parsed <= 0) return fallback;
  return Math.min(parsed, max);
}

async function assertOwner(memoryId: string, apiKeyId: string): Promise<void> {
  const memory = await getMemory(memoryId);
  if (!memory) throw new Error(`Memory not found: ${memoryId}`);
  if (memory.apiKeyId !== apiKeyId) {
    throw new Error("Memory does not belong to this API key");
  }
}

function memoryToPlain(memory: Awaited<ReturnType<typeof createMemory>>) {
  return {
    id: memory.id,
    type: memory.type,
    key: memory.key,
    content: memory.content,
    metadata: memory.metadata,
    createdAt: memory.createdAt.toISOString(),
    updatedAt: memory.updatedAt.toISOString(),
  };
}

async function handleMemorySave(input: Record<string, unknown>, context: { apiKeyId: string; sessionId: string }) {
  const { type, key, content, metadata } = input as {
    type?: string;

View on GitHub (pinned to a179ffed5b)

When it happens

Trigger: Thrown at src/lib/skills/memoryBuiltins.ts:39 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25). Data as JSON: /api/errors/45e997be97b956ee. Report an issue: GitHub.