{"record":{"id":"99526819ac5c5283","repo":"thedotmack/claude-mem","slug":"plugin-mcp-json-mcp-search-launcher-must-include-995268","errorCode":null,"errorMessage":"plugin/.mcp.json mcp-search launcher must include Claude cache fallback for hosts that do not inject PLUGIN_ROOT","messagePattern":"plugin/\\.mcp\\.json mcp-search launcher must include Claude cache fallback for hosts that do not inject PLUGIN_ROOT","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"scripts/build-hooks.js","lineNumber":749,"sourceCode":"      }\n    }\n    for (const eventName of Object.keys(codexHooks.hooks ?? {})) {\n      if (!validCodexHookEvents.has(eventName)) {\n        throw new Error(`plugin/hooks/codex-hooks.json contains unknown Codex hook event: ${eventName}`);\n      }\n    }\n    const codexMarketplace = JSON.parse(fs.readFileSync('.agents/plugins/marketplace.json', 'utf-8'));\n    const claudeMemMarketplaceEntry = (codexMarketplace.plugins ?? []).find((plugin) => plugin.name === 'claude-mem');\n    if (claudeMemMarketplaceEntry?.source?.path !== './plugin') {\n      throw new Error('.agents/plugins/marketplace.json must point claude-mem source.path at ./plugin so Codex loads the bundled plugin root');\n    }\n    const bundledMcp = JSON.parse(fs.readFileSync('plugin/.mcp.json', 'utf-8'));\n    const mcpSearchCommand = bundledMcp.mcpServers?.['mcp-search']?.args?.join(' ') ?? '';\n    if (!mcpSearchCommand.includes('.codex/plugins/cache/claude-mem-local/claude-mem')) {\n      throw new Error('plugin/.mcp.json mcp-search launcher must include Codex cache fallback for hosts that do not inject PLUGIN_ROOT');\n    }\n    if (!mcpSearchCommand.includes('plugins/cache/thedotmack/claude-mem')) {\n      throw new Error('plugin/.mcp.json mcp-search launcher must include Claude cache fallback for hosts that do not inject PLUGIN_ROOT');\n    }\n    console.log('✓ All required distribution files present');\n\n    await verifyShellTemplateCanonical();\n\n    console.log('\\n✅ All build targets compiled successfully!');\n    console.log(`   Output: ${hooksDir}/`);\n    console.log(`   - Worker: worker-service.cjs`);\n    console.log(`   - Server: server-service.cjs`);\n    console.log(`   - MCP Server: mcp-server.cjs`);\n    console.log(`   - Context Generator: context-generator.cjs`);\n    console.log(`   - Transcript Watcher: transcript-watcher.cjs`);\n    console.log(`   Output: ${npxCliOutDir}/`);\n    console.log(`   - NPX CLI: index.js`);\n    if (fs.existsSync('openclaw/dist/index.js')) {\n      console.log(`   Output: openclaw/dist/`);\n      console.log(`   - OpenClaw Plugin: index.js`);\n    }","sourceCodeStart":731,"sourceCodeEnd":767,"githubUrl":"https://github.com/thedotmack/claude-mem/blob/d768ba364302d12b76e69e4f021f0bb1d2d50ed6/scripts/build-hooks.js#L731-L767","documentation":"Twin of [14] for the Claude host: the joined mcp-search command must contain 'plugins/cache/thedotmack/claude-mem'. This is the Claude Code marketplace cache fallback for hosts that don't inject PLUGIN_ROOT. Missing it breaks mcp-search under Claude Code.","triggerScenarios":"Editing the mcp-search launcher and dropping the Claude cache fallback fragment. Generator change that no longer emits the thedotmack cache path.","commonSituations":"Same as [14] — simplifying the launcher, assuming PLUGIN_ROOT is always present, or removing cache fallback branches.","solutions":["Restore the 'plugins/cache/thedotmack/claude-mem' fragment in the mcp-search launcher in plugin/.mcp.json.","If generator-produced, ensure src/build/hook-shell-template.ts emits the Claude cache fallback branch, then run node scripts/build-hooks.js --write-shell-templates.","Re-run the build; the check at scripts/build-hooks.js:748-751 must pass."],"exampleFix":"// before: launcher lacks the Claude cache fallback\n\"args\": [\"...\", \"exec \\\"$PLUGIN_ROOT/mcp-search\\\"\"]\n\n// after: also try the Claude marketplace cache\n\"args\": [\"...\", \"... || exec \\\"plugins/cache/thedotmack/claude-mem/mcp-search\\\"\"]","handlingStrategy":"validation","validationCode":"const mcp = JSON.parse(fs.readFileSync('plugin/.mcp.json','utf8'));\nconst cmd = (mcp.mcpServers?.['mcp-search']?.args ?? []).join(' ');\nif (!cmd.includes('plugins/cache/thedotmack/claude-mem')) {\n  throw new Error('mcp-search launcher missing Claude cache fallback');\n}","typeGuard":null,"tryCatchPattern":"// Build-time only. Restore the Claude cache-fallback fragment, or regenerate via\n// --write-shell-templates after fixing the generator.","preventionTips":["Treat the mcp-search launcher as generator-owned.","Preserve both cache-fallback branches when editing buildShellCommand.","CI should assert both '.codex/plugins/cache/claude-mem-local/claude-mem' and 'plugins/cache/thedotmack/claude-mem'."],"tags":["build","verification","mcp","claude","plugin-root","cache-fallback"],"backgroundTag":null,"analyzedSha":"d768ba364302d12b76e69e4f021f0bb1d2d50ed6","analyzedAt":"2026-08-12T23:52:55.241Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}