{"record":{"id":"270bab93fd92a129","repo":"paperclipai/paperclip","slug":"embedded-postgresql-support-requires-dependency-e-270bab","errorCode":null,"errorMessage":"Embedded PostgreSQL support requires dependency `embedded-postgres`. Reinstall dependencies and try again.","messagePattern":"Embedded PostgreSQL support requires dependency `embedded-postgres`\\. Reinstall dependencies and try again\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/worktree.ts","lineNumber":1114,"sourceCode":"  try {\n    chmodSync(input.targetKeyFilePath, 0o600);\n  } catch {\n    // best effort\n  }\n}\n\nexport async function ensureEmbeddedPostgres(\n  dataDir: string,\n  preferredPort: number,\n  options: { allowExisting?: boolean } = {},\n): Promise<EmbeddedPostgresHandle> {\n  const moduleName = \"embedded-postgres\";\n  let EmbeddedPostgres: EmbeddedPostgresCtor;\n  try {\n    const mod = await loadWithoutEmbeddedPostgresExitHooks(() => import(moduleName));\n    EmbeddedPostgres = mod.default as EmbeddedPostgresCtor;\n  } catch {\n    throw new Error(\n      \"Embedded PostgreSQL support requires dependency `embedded-postgres`. Reinstall dependencies and try again.\",\n    );\n  }\n  await prepareEmbeddedPostgresNativeRuntime();\n\n  const postmasterPidFile = path.resolve(dataDir, \"postmaster.pid\");\n  const runningPid = readRunningPostmasterPid(postmasterPidFile);\n  if (runningPid) {\n    if (options.allowExisting === false) {\n      throw new Error(\n        `Cannot seed target embedded PostgreSQL at ${dataDir} while it is already running (pid=${runningPid}). `\n        + \"Stop the worktree service that owns this database, then retry the seed.\",\n      );\n    }\n    return {\n      port: readPidFilePort(postmasterPidFile) ?? preferredPort,\n      startedByThisProcess: false,\n      stop: async () => {},","sourceCodeStart":1096,"sourceCodeEnd":1132,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/cli/src/commands/worktree.ts#L1096-L1132","documentation":"The CLI worktree command could not import the optional embedded-postgres package; local embedded database support in the CLI requires that dependency to be installed, and the import failure is rethrown as this explicit error.","triggerScenarios":"Thrown at cli/src/commands/worktree.ts:1094 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Reinstall dependencies so `embedded-postgres` is present, then retry."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-08-21T17:58:32.592Z","contentChangedAt":"2026-08-21T17:58:32.592Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}