{"record":{"id":"c8d5a3bd7fa57a1a","repo":"paperclipai/paperclip","slug":"worktree-seed-lock-lockpath-belongs-to-exited-p","errorCode":null,"errorMessage":"Worktree seed lock ${lockPath} belongs to exited process ${currentOwner.pid}. Verify that no seed is running, then remove the stale lock and retry.","messagePattern":"Worktree seed lock (.+?) belongs to exited process (.+?)\\. Verify that no seed is running, then remove the stale lock and retry\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/src/commands/worktree.ts","lineNumber":2087,"sourceCode":"        const current = await fsPromises.readFile(lockPath, \"utf8\").catch(() => null);\n        if (current && parseWorktreeSeedLockOwner(current)?.token === owner.token) {\n          await fsPromises.rm(lockPath, { force: true });\n        }\n      };\n    } catch (error) {\n      if ((error as NodeJS.ErrnoException).code !== \"EEXIST\") throw error;\n    }\n\n    const [rawOwner, lockStat] = await Promise.all([\n      fsPromises.readFile(lockPath, \"utf8\").catch(() => null),\n      fsPromises.stat(lockPath).catch(() => null),\n    ]);\n    const currentOwner = rawOwner ? parseWorktreeSeedLockOwner(rawOwner) : null;\n    const malformedLockIsStale = Boolean(\n      lockStat && Date.now() - lockStat.mtimeMs >= WORKTREE_SEED_LOCK_MALFORMED_STALE_MS,\n    );\n    if (currentOwner && !processIsAlive(currentOwner.pid)) {\n      throw new Error(\n        `Worktree seed lock ${lockPath} belongs to exited process ${currentOwner.pid}. `\n        + \"Verify that no seed is running, then remove the stale lock and retry.\",\n      );\n    }\n    if (!currentOwner && malformedLockIsStale) {\n      throw new Error(\n        `Worktree seed lock ${lockPath} is stale or malformed. `\n        + \"Verify that no seed is running, then remove the stale lock and retry.\",\n      );\n    }\n    await new Promise((resolve) => setTimeout(resolve, WORKTREE_SEED_LOCK_POLL_MS));\n  }\n}\n\nfunction startWorktreeSeedAttempt(configPath: string, now = new Date()): WorktreeSeedManifest {\n  const markers = resolveWorktreeSeedMarkerPaths(configPath);\n  const current = readWorktreeSeedManifest(configPath);\n  if (!current) throw new Error(`Worktree seed manifest does not exist at ${markers.manifest}.`);","sourceCodeStart":2069,"sourceCodeEnd":2105,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/cli/src/commands/worktree.ts#L2069-L2105","documentation":"Stale-lock diagnostic in the worktree seed lock: the lock file names an owner PID that is no longer alive, so the lock is leftover from a crashed seed; the operator must confirm no seed is running before deleting it and retrying.","triggerScenarios":"Thrown at cli/src/commands/worktree.ts:1534 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify no seed process is running, then remove the stale lock at ${lockPath} and retry."],"exampleFix":null,"handlingStrategy":"retry","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"}