{"record":{"id":"6b4187a4da7cc2d1","repo":"thedotmack/claude-mem","slug":"instruction-not-found","errorCode":null,"errorMessage":"Instruction not found","messagePattern":"Instruction not found","errorType":"http","errorClass":null,"httpStatus":404,"severity":"warning","filePath":"src/services/server/Server.ts","lineNumber":305,"sourceCode":"    });\n\n    this.app.get('/api/instructions', (req: Request, res: Response) => {\n      const topic = (req.query.topic as string) || 'all';\n      const operation = req.query.operation as string | undefined;\n\n      if (topic && !ALLOWED_TOPICS.includes(topic)) {\n        return res.status(400).json({ error: 'Invalid topic' });\n      }\n\n      if (operation && !ALLOWED_OPERATIONS.includes(operation)) {\n        return res.status(400).json({ error: 'Invalid operation' });\n      }\n\n      if (operation) {\n        const cached = cachedOperationContent.get(operation);\n        if (cached === undefined) {\n          logger.debug('HTTP', 'Instruction file not cached at boot', { operation });\n          return res.status(404).json({ error: 'Instruction not found' });\n        }\n        return res.json({ content: [{ type: 'text', text: cached }] });\n      }\n\n      if (cachedSkillMd === null) {\n        logger.debug('HTTP', 'SKILL.md not cached at boot', { topic });\n        return res.status(404).json({ error: 'Instruction not found' });\n      }\n      const sectionText = this.extractInstructionSection(cachedSkillMd, topic);\n      res.json({ content: [{ type: 'text', text: sectionText }] });\n    });\n\n    this.app.post('/api/admin/restart', requireLocalhost, async (_req: Request, res: Response) => {\n      const isWindowsManaged = process.platform === 'win32' &&\n        process.env.CLAUDE_MEM_MANAGED === 'true' &&\n        process.send;\n\n      if (isWindowsManaged) {","sourceCodeStart":287,"sourceCodeEnd":323,"githubUrl":"https://github.com/thedotmack/claude-mem/blob/d8bc9755e74915e5c3b999181e10a67c889bce2a/src/services/server/Server.ts#L287-L323","documentation":"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.","triggerScenarios":"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.","commonSituations":"Fresh install or Docker image missing instruction files; plugin updated instructions but the worker process was not restarted; file deleted or renamed on disk.","solutions":["Verify the instruction file for that operation exists in the instructions directory","Restart the worker so cachedOperationContent is repopulated at boot","Run the build/install step that ships instruction files (npm run build-and-sync)"],"exampleFix":"// before\n# instruction file missing, worker started anyway\n// after\nls src/instructions/<operation>.md  # ensure present, then restart worker","handlingStrategy":"fallback","validationCode":"// ensure the instruction file exists before calling\nconst exists = await fs.access(path.join(instructionsDir, `${operation}.md`)).then(() => true, () => false);","typeGuard":null,"tryCatchPattern":"const res = await fetch(url);\nif (res.status === 404) {\n  // fall back to bundled instruction content or surface a restart hint\n}","preventionTips":["Restart the worker after adding/changing instruction files","Verify instruction files ship in your build/install artifact","Health-check instruction availability at startup"],"tags":["http","cache","not-found"],"backgroundTag":"resource-not-found","analyzedSha":"d8bc9755e74915e5c3b999181e10a67c889bce2a","analyzedAt":"2026-09-17T16:40:26.182Z","contentChangedAt":"2026-09-17T16:40:26.182Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}