{"record":{"id":"9c91c4eb3116ba59","repo":"thedotmack/claude-mem","slug":"missing-required-distribution-file-filepath","errorCode":null,"errorMessage":"Missing required distribution file: ${filePath}","messagePattern":"Missing required distribution file: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"scripts/build-hooks.js","lineNumber":723,"sourceCode":"      'plugin/skills/mode-creator/scripts/install-mode.mjs',\n      'plugin/skills/mode-creator/scripts/configure-telegram.mjs',\n      'plugin/skills/smart-explore/SKILL.md',\n      'plugin/skills/how-it-works/SKILL.md',\n      'plugin/skills/how-it-works/onboarding-explainer.md',\n      'plugin/hooks/hooks.json',\n      'plugin/hooks/codex-hooks.json',\n      'plugin/scripts/bun-runner.js',\n      'plugin/sqlite/SessionStore.js',\n      'plugin/sqlite/observations/files.js',\n      'plugin/.claude-plugin/plugin.json',\n      'plugin/.codex-plugin/plugin.json',\n      'plugin/.mcp.json',\n      '.codex-plugin/plugin.json',\n      '.agents/plugins/marketplace.json',\n    ];\n    for (const filePath of requiredDistributionFiles) {\n      if (!fs.existsSync(filePath)) {\n        throw new Error(`Missing required distribution file: ${filePath}`);\n      }\n    }\n    const codexHooks = JSON.parse(fs.readFileSync('plugin/hooks/codex-hooks.json', 'utf-8'));\n    const validCodexHookRootKeys = new Set(['hooks']);\n    for (const rootKey of Object.keys(codexHooks)) {\n      if (!validCodexHookRootKeys.has(rootKey)) {\n        throw new Error(`plugin/hooks/codex-hooks.json contains unsupported Codex root key: ${rootKey}`);\n      }\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');","sourceCodeStart":705,"sourceCodeEnd":741,"githubUrl":"https://github.com/thedotmack/claude-mem/blob/d768ba364302d12b76e69e4f021f0bb1d2d50ed6/scripts/build-hooks.js#L705-L741","documentation":"After building, the script iterates a hard-coded list of required distribution files (hooks JSONs, bun-runner.js, SessionStore.js, observations/files.js, plugin manifests, .mcp.json, marketplace.json) and asserts each exists on disk. Any missing file aborts the build — the plugin would ship incomplete and hosts would fail to load it.","triggerScenarios":"Running the build when one of the listed build outputs was not produced (esbuild step skipped or failed silently), or when a required file was deleted from the repo. The error names the exact missing path.","commonSituations":"A build step earlier in buildHooks() threw partway and was swallowed, leaving e.g. plugin/sqlite/SessionStore.js unbuilt. A PR that moves a file but doesn't update the requiredDistributionFiles list. Fresh clone where generated files haven't been produced yet.","solutions":["Inspect the named path: if it's a generated file, ensure the preceding build step (worker/server/sqlite bundle) ran and succeeded.","If the file is source-controlled, restore it: git checkout HEAD -- <filePath>.","If the list is stale after a legit move, update requiredDistributionFiles in scripts/build-hooks.js (lines ~713-723) to the new path.","Re-run node scripts/build-hooks.js end-to-end and confirm it reaches '✓ All required distribution files present'."],"exampleFix":"# before: build aborts — 'Missing required distribution file: plugin/sqlite/SessionStore.js'\n\n# regenerate the missing artifact by running the full build (do not hand-create it)\nnpm run build-and-sync\n\n# if the path moved legitimately, update scripts/build-hooks.js requiredDistributionFiles:\n#   'plugin/sqlite/SessionStore.js' -> 'plugin/sqlite/<new>/SessionStore.js'","handlingStrategy":"validation","validationCode":"// Reuse the same requiredDistributionFiles list to pre-flight the tree:\nconst required = ['plugin/hooks/codex-hooks.json','plugin/scripts/bun-runner.js','plugin/sqlite/SessionStore.js','plugin/sqlite/observations/files.js','plugin/.claude-plugin/plugin.json','plugin/.codex-plugin/plugin.json','plugin/.mcp.json','.codex-plugin/plugin.json','.agents/plugins/marketplace.json'];\nconst missing = required.filter(p => !fs.existsSync(p));\nif (missing.length) throw new Error('Missing: ' + missing.join(', '));","typeGuard":null,"tryCatchPattern":"// Build-time only. Regenerate via npm run build-and-sync, restore source files\n// via git, or update the list if a path moved. Do not suppress.","preventionTips":["Always build via the canonical script so every output is produced.","When moving a required file, update requiredDistributionFiles in the same PR.","Run the build in CI on every PR so a missing artifact blocks merge."],"tags":["build","verification","distribution","plugin"],"backgroundTag":null,"analyzedSha":"d768ba364302d12b76e69e4f021f0bb1d2d50ed6","analyzedAt":"2026-08-12T23:52:55.241Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}