{"record":{"id":"c78aa09b9309b634","repo":"paperclipai/paperclip","slug":"could-not-locate-a-paperclip-server-entrypoint-nt","errorCode":null,"errorMessage":"Could not locate a Paperclip server entrypoint.\\nTried: ${devEntry}, @paperclipai/server\\n${formatError(err)}","messagePattern":"Could not locate a Paperclip server entrypoint\\.\\\\nTried: (.+?), @paperclipai/server\\\\n(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"cli/src/commands/run.ts","lineNumber":204,"sourceCode":"  // Dev mode: try local workspace path (monorepo with tsx)\n  const projectRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), \"../../..\");\n  const devEntry = path.resolve(projectRoot, \"server/src/index.ts\");\n  if (fs.existsSync(devEntry)) {\n    ensureDevWorkspaceBuildDeps(projectRoot);\n    maybeEnableUiDevMiddleware(devEntry);\n    const mod = await import(pathToFileURL(devEntry).href);\n    return await startServerFromModule(mod, devEntry);\n  }\n\n  // Production mode: import the published @paperclipai/server package\n  try {\n    const mod = await import(\"@paperclipai/server\");\n    return await startServerFromModule(mod, \"@paperclipai/server\");\n  } catch (err) {\n    const missingSpecifier = getMissingModuleSpecifier(err);\n    const missingServerEntrypoint = !missingSpecifier || missingSpecifier === \"@paperclipai/server\";\n    if (isModuleNotFoundError(err) && missingServerEntrypoint) {\n      throw new Error(\n        `Could not locate a Paperclip server entrypoint.\\n` +\n          `Tried: ${devEntry}, @paperclipai/server\\n` +\n          `${formatError(err)}`,\n      );\n    }\n    throw new Error(\n      `Paperclip server failed to start.\\n` +\n        `${formatError(err)}`,\n    );\n  }\n}\n\nfunction shouldGenerateBootstrapInviteAfterStart(config: PaperclipConfig): boolean {\n  return config.server.deploymentMode === \"authenticated\" && config.database.mode === \"embedded-postgres\";\n}\n\nasync function startServerFromModule(mod: unknown, label: string): Promise<StartedServer> {\n  const startServer = (mod as { startServer?: () => Promise<StartedServer> }).startServer;","sourceCodeStart":186,"sourceCodeEnd":222,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/cli/src/commands/run.ts#L186-L222","documentation":"Thrown by importServerEntry() when neither the local dev entrypoint nor the published `@paperclipai/server` package could be resolved. The dev path did not exist on disk, and the production import threw a MODULE_NOT_FOUND whose specifier is absent or exactly `@paperclipai/server`.","triggerScenarios":"Running the CLI outside the monorepo (no `server/src/index.ts`) and `@paperclipai/server` is not installed in node_modules — e.g. a globally installed CLI whose dependencies were pruned, or a partial npm install.","commonSituations":"Global CLI install that lost its server dependency; `npm install --production` stripping the server; running a dev checkout from the wrong directory so the relative projectRoot resolves to nowhere; corrupt node_modules.","solutions":["Reinstall the CLI with its full dependencies: `pnpm install` / `npm install` (do not prune).","If installed globally, reinstall the global package: `npm i -g @paperclipcli/cli` (or the repo's published name).","Verify resolution: `node -e \"import('@paperclipai/server')\"` from the install location.","If developing, ensure you are running from the monorepo root where `server/src/index.ts` exists."],"exampleFix":"# before\npaperclipai run\n# after\npnpm install\nnode -e \"import('@paperclipai/server')\"  # verify\npaperclipai run","handlingStrategy":"try-catch","validationCode":"import { createRequire } from 'node:module';\nimport fs from 'node:fs';\nconst require = createRequire(import.meta.url);\nfunction serverResolvable(devEntry: string): boolean {\n  if (fs.existsSync(devEntry)) return true;\n  try { require.resolve('@paperclipai/server'); return true; } catch { return false; }\n}","typeGuard":null,"tryCatchPattern":"try {\n  await import('@paperclipai/server');\n} catch (err) {\n  if (isModuleNotFoundError(err)) { console.error('Server package not installed. Reinstall.'); process.exit(1); }\n  throw err;\n}","preventionTips":["Do not prune dependencies when installing the CLI globally.","Pin CLI and server versions together in a lockfile."],"tags":["server","entrypoint","module-not-found","install","run"],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}