thedotmack/claude-mem · critical · Error
Missing required distribution file: ${filePath}
Error message
Missing required distribution file: ${filePath} What it means
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.
Source
Thrown at scripts/build-hooks.js:723
'plugin/skills/mode-creator/scripts/install-mode.mjs',
'plugin/skills/mode-creator/scripts/configure-telegram.mjs',
'plugin/skills/smart-explore/SKILL.md',
'plugin/skills/how-it-works/SKILL.md',
'plugin/skills/how-it-works/onboarding-explainer.md',
'plugin/hooks/hooks.json',
'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',
];
for (const filePath of requiredDistributionFiles) {
if (!fs.existsSync(filePath)) {
throw new Error(`Missing required distribution file: ${filePath}`);
}
}
const codexHooks = JSON.parse(fs.readFileSync('plugin/hooks/codex-hooks.json', 'utf-8'));
const validCodexHookRootKeys = new Set(['hooks']);
for (const rootKey of Object.keys(codexHooks)) {
if (!validCodexHookRootKeys.has(rootKey)) {
throw new Error(`plugin/hooks/codex-hooks.json contains unsupported Codex root key: ${rootKey}`);
}
}
for (const eventName of Object.keys(codexHooks.hooks ?? {})) {
if (!validCodexHookEvents.has(eventName)) {
throw new Error(`plugin/hooks/codex-hooks.json contains unknown Codex hook event: ${eventName}`);
}
}
const codexMarketplace = JSON.parse(fs.readFileSync('.agents/plugins/marketplace.json', 'utf-8'));
const claudeMemMarketplaceEntry = (codexMarketplace.plugins ?? []).find((plugin) => plugin.name === 'claude-mem');
if (claudeMemMarketplaceEntry?.source?.path !== './plugin') {
throw new Error('.agents/plugins/marketplace.json must point claude-mem source.path at ./plugin so Codex loads the bundled plugin root');View on GitHub (pinned to d768ba3643)
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'.
Example fix
# before: build aborts — 'Missing required distribution file: plugin/sqlite/SessionStore.js' # regenerate the missing artifact by running the full build (do not hand-create it) npm run build-and-sync # if the path moved legitimately, update scripts/build-hooks.js requiredDistributionFiles: # 'plugin/sqlite/SessionStore.js' -> 'plugin/sqlite/<new>/SessionStore.js'
Defensive patterns
Strategy: validation
Validate before calling
// Reuse the same requiredDistributionFiles list to pre-flight the tree:
const 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'];
const missing = required.filter(p => !fs.existsSync(p));
if (missing.length) throw new Error('Missing: ' + missing.join(', ')); Try / catch
// Build-time only. Regenerate via npm run build-and-sync, restore source files // via git, or update the list if a path moved. Do not suppress.
Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Hand-edited shell string detected in ${filePath} (mcp-search
- Hand-edited shell string detected in ${filePath} (${dottedPa
- Hand-edited Windows shell string detected in ${filePath} (${
- plugin/scripts/bun-runner.js is missing fixBrokenScriptPath
- plugin/scripts/bun-runner.js uses optional chaining (?.) or
AI-assisted analysis of thedotmack/claude-mem@d768ba3643 (2026-08-12).
Data as JSON: /api/errors/9c91c4eb3116ba59.
Report an issue: GitHub.