{"record":{"id":"f61b69bfdf9558b2","repo":"thedotmack/claude-mem","slug":"post-install-check-failed-unresolvable-modules","errorCode":null,"errorMessage":"Post-install check failed: unresolvable modules: ${unresolvable.join(', ')}","messagePattern":"Post-install check failed: unresolvable modules: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/npx-cli/install/setup-runtime.ts","lineNumber":321,"sourceCode":"  }\n\n  // zod ships its public API behind subpath exports the worker bundle requires.\n  // The package dir existing does NOT imply these subpaths resolve (#2730).\n  if (dependencies.includes('zod')) {\n    for (const subpath of ZOD_REQUIRED_SUBPATHS) {\n      try {\n        requireFromTarget.resolve(subpath, { paths: resolvePaths });\n      } catch {\n        // [ANTI-PATTERN IGNORED]: subpath resolve failure is the condition being\n        // probed; it is collected in `unresolvable` and surfaced as a loud\n        // install failure below.\n        unresolvable.push(subpath);\n      }\n    }\n  }\n\n  if (unresolvable.length > 0) {\n    throw new Error(\n      `Post-install check failed: unresolvable modules: ${unresolvable.join(', ')}`,\n    );\n  }\n}\n\n/** Build an ephemeral summary so callers (e.g. repair) may omit it. */\nfunction summaryOrEphemeral(summary?: InstallSummary): InstallSummary {\n  return summary ?? { warnings: [], failedIDEs: [] };\n}\n\nexport async function ensureBun(summary?: InstallSummary): Promise<{ bunPath: string; version: string }> {\n  const sum = summaryOrEphemeral(summary);\n  if (!isBunInstalled()) {\n    // installBun throws a platform-specific Error on failure; route it through\n    // the central decision point so it becomes a loud ABORT (bun is mandatory\n    // for hooks — there is no opt-out).\n    try {\n      installBun();","sourceCodeStart":303,"sourceCodeEnd":339,"githubUrl":"https://github.com/thedotmack/claude-mem/blob/d8bc9755e74915e5c3b999181e10a67c889bce2a/src/npx-cli/install/setup-runtime.ts#L303-L339","documentation":"verifyCriticalModules is a post-install sanity check that resolves a set of critical module subpaths from the plugin target directory; if any cannot be resolved (unresolvable array non-empty), it throws listing them. This catches 'bun install said OK but the package is broken/incomplete'.","triggerScenarios":"installPluginDependencies runs verifyCriticalModules(targetDir) after bun install and one or more expected subpaths fail module resolution in the freshly installed dependency tree.","commonSituations":"Corrupted or partial bun install (network interruption), wrong/empty targetDir, package exports misconfigured, or a dependency version bump renaming entry points.","solutions":["Re-run repair/install to redo 'bun install' in the plugin directory cleanly.","Delete node_modules (and lockfile) in the target dir and reinstall from scratch.","Verify the expected package versions/exports exist; check for renamed subpaths after upgrades.","Confirm the target directory is the correct plugin install location."],"exampleFix":"// before\ncd ~/.claude/plugin && bun install   # partial install leaves modules unresolvable\n// after\nrm -rf node_modules bun.lock && bun install   # clean reinstall, then re-run repair","handlingStrategy":"validation","validationCode":"import { createRequire } from 'module';\nconst require = createRequire(path.join(targetDir, 'package.json'));\nconst unresolved = CRITICAL_SUBPATHS.filter((s) => { try { require.resolve(s); return false; } catch { return true; } });\nif (unresolved.length) await reinstall();","typeGuard":null,"tryCatchPattern":"try {\n  await installPluginDependencies(targetDir);\n} catch (e) {\n  if (/unresolvable modules/.test(String(e))) {\n    console.error('Corrupt install; wipe node_modules and reinstall:', e);\n  }\n}","preventionTips":["Verify installs on a stable network to avoid partial dependency trees.","After dependency upgrades, check for renamed entry points/exports.","Run install/repair rather than hand-copying plugin directories.","Pin plugin dependency versions to known-good releases."],"tags":["post-install","module-resolution","verification"],"backgroundTag":"module-init-failed","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"}