diegosouzapw/OmniRoute · error
Missing required field: key
Error message
Missing required field: key
What it means
Required-field guard in handleMemorySave: the `key` input is missing, empty, or not a string. The key is the memory's lookup identifier; without it the record cannot be persisted, so validation fails before type/content checks.
Solutions
- Include a non-empty string key in the memory_save input
- Use a stable, descriptive key so later lookups succeed
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/lib/skills/memoryBuiltins.ts:62 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/73b191d77eb45fc4.
Report an issue: GitHub.
Appendix: source
Thrown at src/lib/skills/memoryBuiltins.ts:62
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;
key: string;
content: string;
metadata?: Record<string, unknown>;
};
if (!key || typeof key !== "string") throw new Error("Missing required field: key");
if (!content || typeof content !== "string") throw new Error("Missing required field: content");
const saved = await createMemory({
apiKeyId: context.apiKeyId,
sessionId: context.sessionId || "",
type: toMemoryType(type),
key,
content,
metadata: metadata && typeof metadata === "object" ? metadata : {},
expiresAt: null,
});
return {
success: true,
memory: memoryToPlain(saved),
message: "Memory saved successfully",
context: context.apiKeyId,
};View on GitHub (pinned to a179ffed5b)