{"record":{"id":"527a53c7ddc29c63","repo":"paperclipai/paperclip","slug":"target-worktree-database-appears-to-be-running-pi-527a53","errorCode":null,"errorMessage":"Target worktree database appears to be running (pid ${runningTargetPid}). Stop Paperclip in ${target.rootPath} before repairing, or re-run with --allow-live-target if you want to override this guard.","messagePattern":"Target worktree database appears to be running \\(pid (.+?)\\)\\. Stop Paperclip in (.+?) before repairing, or re-run with --allow-live-target if you want to override this guard\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/worktree.ts","lineNumber":4415,"sourceCode":"      fromConfig: source.configPath,\n      to: target.rootPath,\n      seedMode,\n      preserveLiveWork: opts.preserveLiveWork,\n      yes: true,\n      allowLiveTarget: opts.allowLiveTarget,\n    });\n    return;\n  }\n\n  const repairInstanceId = sanitizeWorktreeInstanceId(path.basename(target.rootPath));\n  const repairPaths = resolveWorktreeLocalPaths({\n    cwd: target.rootPath,\n    homeDir: resolveWorktreeHome(opts.home),\n    instanceId: repairInstanceId,\n  });\n  const runningTargetPid = readRunningPostmasterPid(path.resolve(repairPaths.embeddedPostgresDataDir, \"postmaster.pid\"));\n  if (runningTargetPid && !opts.allowLiveTarget) {\n    throw new Error(\n      `Target worktree database appears to be running (pid ${runningTargetPid}). Stop Paperclip in ${target.rootPath} before repairing, or re-run with --allow-live-target if you want to override this guard.`,\n    );\n  }\n  if (runningTargetPid && opts.allowLiveTarget) {\n    p.log.warning(`Proceeding even though the target embedded PostgreSQL appears to be running (pid ${runningTargetPid}).`);\n  }\n\n  const originalCwd = process.cwd();\n  try {\n    process.chdir(target.rootPath);\n    await runWorktreeInit({\n      home: opts.home,\n      fromConfig: source.configPath,\n      fromDataDir: opts.fromDataDir,\n      fromInstance: opts.fromInstance,\n      seed: opts.noSeed ? false : true,\n      seedMode,\n      preserveLiveWork: opts.preserveLiveWork,","sourceCodeStart":4397,"sourceCodeEnd":4433,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/cli/src/commands/worktree.ts#L4397-L4433","documentation":"Error \"Target worktree database appears to be running (pid ${runningTargetPid}). Stop Paperclip in ${target.rootPath} before repairing, or re-run with --allow-live-target if you want to override this guard.\" thrown in paperclipai/paperclip.","triggerScenarios":"Thrown at cli/src/commands/worktree.ts:3554 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Stop Paperclip in ${target.rootPath} and retry the repair.","Re-run with --allow-live-target to override the guard (risky)."],"exampleFix":null,"handlingStrategy":"validation","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-23T08:17:48.524Z"}