paperclipai/paperclip · error

Target path already exists

Error message

Target path already exists: ${targetPath}

What it means

Clobber guard in worktree:make: the computed target worktree directory already exists on disk, so creating a new worktree there would overwrite existing content; the name or worktrees home must be changed.

Solutions

  1. Choose a different target path.
  2. Move or remove the existing directory at ${targetPath} and retry.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at cli/src/commands/worktree.ts:1823 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/bec02f84ddb998f1. Report an issue: GitHub.

Appendix: source

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

    }
    p.outro(pc.green("Worktree database seed complete."));
  } catch (error) {
    spinner.stop(pc.red("Failed to seed worktree database."));
    throw error;
  }
}

export async function worktreeMakeCommand(nameArg: string, opts: WorktreeMakeOptions): Promise<void> {
  printPaperclipCliBanner();
  p.intro(pc.bgCyan(pc.black(" paperclipai worktree:make ")));

  const name = resolveWorktreeMakeName(nameArg);
  const startPoint = resolveWorktreeStartPoint(opts.startPoint);
  const sourceCwd = process.cwd();
  const sourceConfigPath = resolveSourceConfigPath(opts);
  const targetPath = resolveWorktreeMakeTargetPath(name);
  if (existsSync(targetPath)) {
    throw new Error(`Target path already exists: ${targetPath}`);
  }

  mkdirSync(path.dirname(targetPath), { recursive: true });
  if (startPoint) {
    const [remote] = startPoint.split("/", 1);
    try {
      execFileSync("git", ["fetch", remote], {
        cwd: sourceCwd,
        stdio: ["ignore", "pipe", "pipe"],
      });
    } catch (error) {
      throw new Error(
        `Failed to fetch from remote "${remote}": ${extractExecSyncErrorMessage(error) ?? String(error)}`,
      );
    }
  }

  const worktreeArgs = resolveGitWorktreeAddArgs({

View on GitHub (pinned to 01ad858492)