paperclipai/paperclip · error

Worktree seed lock belongs to exited process . Verify that…

Error message

Worktree seed lock ${lockPath} belongs to exited process ${currentOwner.pid}. Verify that no seed is running, then remove the stale lock and retry.

What it means

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.

Solutions

  1. Verify no seed process is running, then remove the stale lock at ${lockPath} and retry.
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at cli/src/commands/worktree.ts:1534 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of paperclipai/paperclip@01ad858492 (2026-08-18). Data as JSON: /api/errors/c8d5a3bd7fa57a1a. Report an issue: GitHub.

Appendix: source

Thrown at cli/src/commands/worktree.ts:2087

        const current = await fsPromises.readFile(lockPath, "utf8").catch(() => null);
        if (current && parseWorktreeSeedLockOwner(current)?.token === owner.token) {
          await fsPromises.rm(lockPath, { force: true });
        }
      };
    } catch (error) {
      if ((error as NodeJS.ErrnoException).code !== "EEXIST") throw error;
    }

    const [rawOwner, lockStat] = await Promise.all([
      fsPromises.readFile(lockPath, "utf8").catch(() => null),
      fsPromises.stat(lockPath).catch(() => null),
    ]);
    const currentOwner = rawOwner ? parseWorktreeSeedLockOwner(rawOwner) : null;
    const malformedLockIsStale = Boolean(
      lockStat && Date.now() - lockStat.mtimeMs >= WORKTREE_SEED_LOCK_MALFORMED_STALE_MS,
    );
    if (currentOwner && !processIsAlive(currentOwner.pid)) {
      throw new Error(
        `Worktree seed lock ${lockPath} belongs to exited process ${currentOwner.pid}. `
        + "Verify that no seed is running, then remove the stale lock and retry.",
      );
    }
    if (!currentOwner && malformedLockIsStale) {
      throw new Error(
        `Worktree seed lock ${lockPath} is stale or malformed. `
        + "Verify that no seed is running, then remove the stale lock and retry.",
      );
    }
    await new Promise((resolve) => setTimeout(resolve, WORKTREE_SEED_LOCK_POLL_MS));
  }
}

function startWorktreeSeedAttempt(configPath: string, now = new Date()): WorktreeSeedManifest {
  const markers = resolveWorktreeSeedMarkerPaths(configPath);
  const current = readWorktreeSeedManifest(configPath);
  if (!current) throw new Error(`Worktree seed manifest does not exist at ${markers.manifest}.`);

View on GitHub (pinned to 01ad858492)