thedotmack/claude-mem · warning
Invalid operation
Error message
Invalid operation
What it means
The worker Server's instruction-lookup route validates the `operation` query parameter against ALLOWED_OPERATIONS before serving cached instruction content. If the operation is not on the allow-list, it responds 400 with 'Invalid operation' instead of looking up content. This is an input allow-list guard, not a runtime fault.
Solutions
- Check ALLOWED_OPERATIONS in src/services/server/Server.ts and use one of the listed values
- Fix the operation name in the calling client to match the current allow-list
- If a new operation is legitimately needed, add its instruction file and register it in ALLOWED_OPERATIONS
Example fix
// before GET /api/instructions?operation=memory-save // after GET /api/instructions?operation=memory_save
Defensive patterns
Strategy: validation
Validate before calling
const ALLOWED = ['memory_save','memory_retrieve']; // mirror ALLOWED_OPERATIONS
if (!ALLOWED.includes(operation)) throw new Error(`Invalid operation: ${operation}`); Prevention
- Derive the operation list from the server's allow-list rather than hardcoding
- Centralize instruction operation names in a shared constant
- Validate query params in client code before sending
When it happens
Trigger: GET to the instructions endpoint with ?operation=<name> where the name is misspelled, renamed in a newer version, or is a topic-style value passed as an operation.
Common situations: Clients hardcoding an operation string that changed when the instruction set was updated; passing a topic name into the operation parameter; typos in integrations or scripts.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
AI-assisted analysis of thedotmack/claude-mem@d8bc9755e7 (2026-09-17).
Data as JSON: /api/errors/25d0bf1d7e229881.
Report an issue: GitHub.
Appendix: source
Thrown at src/services/server/Server.ts:298
message: 'Worker is still initializing, please retry',
});
}
});
this.app.get('/api/version', (_req: Request, res: Response) => {
res.status(200).json({ version: BUILT_IN_VERSION });
});
this.app.get('/api/instructions', (req: Request, res: Response) => {
const topic = (req.query.topic as string) || 'all';
const operation = req.query.operation as string | undefined;
if (topic && !ALLOWED_TOPICS.includes(topic)) {
return res.status(400).json({ error: 'Invalid topic' });
}
if (operation && !ALLOWED_OPERATIONS.includes(operation)) {
return res.status(400).json({ error: 'Invalid operation' });
}
if (operation) {
const cached = cachedOperationContent.get(operation);
if (cached === undefined) {
logger.debug('HTTP', 'Instruction file not cached at boot', { operation });
return res.status(404).json({ error: 'Instruction not found' });
}
return res.json({ content: [{ type: 'text', text: cached }] });
}
if (cachedSkillMd === null) {
logger.debug('HTTP', 'SKILL.md not cached at boot', { topic });
return res.status(404).json({ error: 'Instruction not found' });
}
const sectionText = this.extractInstructionSection(cachedSkillMd, topic);
res.json({ content: [{ type: 'text', text: sectionText }] });
});View on GitHub (pinned to d8bc9755e7)