{"record":{"id":"f87e182027ad8e5a","repo":"paperclipai/paperclip","slug":"paperclip-server-failed-to-start-formaterror-er","errorCode":null,"errorMessage":"Paperclip server failed to start.\n${formatError(err)}","messagePattern":"Paperclip server failed to start\\.\n(.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/run.ts","lineNumber":236,"sourceCode":"    );\n  }\n}\n\nasync function importServerEntry(): Promise<StartedServer> {\n  // 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 {","sourceCodeStart":218,"sourceCodeEnd":254,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/cli/src/commands/run.ts#L218-L254","documentation":"The production import of @paperclipai/server threw for a reason other than it being missing entirely; the server module failed to load/start and the error is wrapped with context.","triggerScenarios":"Thrown at cli/src/commands/run.ts:210 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Read the server startup error in the output (port conflicts, DB issues), fix it, and retry."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}