paperclipai/paperclip · error

Worktree seed lock is stale or malformed. Verify that no…

Error message

Worktree seed lock ${lockPath} is stale or malformed. 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 is unreadable or malformed and has exceeded the staleness age threshold, so it is treated as abandoned rather than honored; remove it after verifying no seed is running.

Solutions

  1. Verify no seed is running, remove the stale or malformed lock file, and retry the seed.
Defensive patterns

Strategy: retry

When it happens

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

Common situations: See trigger scenarios.

Understand the failure class


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

Appendix: source

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

      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}.`);
  const at = now.toISOString();
  const next: WorktreeSeedManifest = {
    ...current,
    state: "running",
    phase: "pending",
    attemptId: randomUUID(),

View on GitHub (pinned to 01ad858492)