thedotmack/claude-mem · warning

Instruction not found

Error message

Instruction not found

What it means

The route found a valid `operation` but cachedOperationContent has no cached content for it — the instruction file was not present/loaded at worker boot. The server returns 404 'Instruction not found'. It deliberately serves from a boot-time cache and does not read from disk per-request.

Solutions

  1. Verify the instruction file for that operation exists in the instructions directory
  2. Restart the worker so cachedOperationContent is repopulated at boot
  3. Run the build/install step that ships instruction files (npm run build-and-sync)

Example fix

// before
# instruction file missing, worker started anyway
// after
ls src/instructions/<operation>.md  # ensure present, then restart worker
Defensive patterns

Strategy: fallback

Validate before calling

// ensure the instruction file exists before calling
const exists = await fs.access(path.join(instructionsDir, `${operation}.md`)).then(() => true, () => false);

Try / catch

const res = await fetch(url);
if (res.status === 404) {
  // fall back to bundled instruction content or surface a restart hint
}

Prevention

When it happens

Trigger: GET with a valid operation whose instruction file was missing at server start; instructions directory not synced; operation added to the allow-list without adding the file then restarting.

Common situations: Fresh install or Docker image missing instruction files; plugin updated instructions but the worker process was not restarted; file deleted or renamed on disk.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of thedotmack/claude-mem@d8bc9755e7 (2026-09-17). Data as JSON: /api/errors/6b4187a4da7cc2d1. Report an issue: GitHub.

Appendix: source

Thrown at src/services/server/Server.ts:305

    });

    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 }] });
    });

    this.app.post('/api/admin/restart', requireLocalhost, async (_req: Request, res: Response) => {
      const isWindowsManaged = process.platform === 'win32' &&
        process.env.CLAUDE_MEM_MANAGED === 'true' &&
        process.send;

      if (isWindowsManaged) {

View on GitHub (pinned to d8bc9755e7)