paperclipai/paperclip · error · Error

No Paperclip worktrees were found. Run `paperclipai worktree

Error message

No Paperclip worktrees were found. Run `paperclipai worktree:list` to inspect the repo worktrees.

What it means

Thrown by promptForSourceEndpoint when the interactive source selector for worktree:merge-history has zero entries after filtering. Choices are kept only if they have a Paperclip config or are the current checkout, the target worktree path is excluded, and if nothing remains the prompt cannot be shown. The message points the user at worktree:list so they can inspect the actual state.

Source

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

  if (!matched.hasPaperclipConfig && !matched.isCurrent) {
    throw new Error(`Resolved worktree "${selector}" does not look like a Paperclip worktree.`);
  }
  return resolveEndpointFromChoice(matched);
}

async function promptForSourceEndpoint(excludeWorktreePath?: string): Promise<ResolvedWorktreeEndpoint> {
  const excluded = excludeWorktreePath ? path.resolve(excludeWorktreePath) : null;
  const currentEndpoint = resolveCurrentWorktreeEndpoint();
  const choices = toMergeSourceChoices(process.cwd())
    .filter((choice) => choice.hasPaperclipConfig || choice.isCurrent)
    .filter((choice) => path.resolve(choice.worktree) !== excluded)
    .map((choice) => ({
      value: choice.isCurrent ? "__current__" : choice.worktree,
      label: choice.branchLabel,
      hint: `${choice.worktree}${choice.isCurrent ? " (current)" : ""}`,
    }));
  if (choices.length === 0) {
    throw new Error("No Paperclip worktrees were found. Run `paperclipai worktree:list` to inspect the repo worktrees.");
  }
  const selection = await p.select<string>({
    message: "Choose the source worktree to import from",
    options: choices,
  });
  if (p.isCancel(selection)) {
    throw new Error("Source worktree selection cancelled.");
  }
  if (selection === "__current__") {
    return currentEndpoint;
  }
  return resolveWorktreeEndpointFromSelector(selection, { allowCurrent: true });
}

async function applyMergePlan(input: {
  sourceStorages: ConfiguredStorage[];
  targetStorage: ConfiguredStorage;
  targetDb: ClosableDb;

View on GitHub (pinned to 67001ec6eb)

Solutions

  1. Pass --from explicitly with a path or branch that has a Paperclip config.
  2. Run `paperclipai worktree init` in another worktree to make it selectable, then retry.
  3. Run `paperclipai worktree:list` to confirm which worktrees are visible and marked [paperclip].
  4. If you only have one instance, seed it via `worktree reseed --from-config` instead of merge-history.

Example fix

// before
paperclipai worktree:merge-history
// after
paperclipai worktree:merge-history --from /path/to/other-worktree
Defensive patterns

Strategy: validation

Validate before calling

import { execFileSync } from "node:child_process";
import fs from "node:fs";
import path from "node:path";

function countSelectableSources(cwd: string, excludePath?: string): number {
  const out = execFileSync("git", ["worktree", "list", "--porcelain"], { cwd, encoding: "utf8" });
  const worktrees = out.split(/\n\n/).map((b) => b.split("\n").find((l) => l.startsWith("worktree "))?.slice(9)).filter(Boolean) as string[];
  return worktrees
    .filter((w) => w !== excludePath)
    .filter((w) => fs.existsSync(path.resolve(w, ".paperclip", "config.json"))).length;
}

// before invoking interactive merge-history:
if (countSelectableSources(process.cwd()) === 0) {
  throw new Error("No Paperclip-configured source worktrees available; pass --from or run worktree init.");
}

Prevention

When it happens

Trigger: Running `paperclipai worktree:merge-history` with no --from flag when (a) there are no other git worktrees, or (b) all other worktrees lack .paperclip/config.json, or (c) the only other configured worktree is the target being excluded.

Common situations: A single-worktree repo where the developer expects an interactive picker but no candidate sources exist. Or after cleaning up extra worktrees, leaving only the current checkout, then trying to import history without specifying --from.

Related errors


AI-assisted analysis of paperclipai/paperclip@67001ec6eb (2026-08-12). Data as JSON: /api/errors/bdc16073a125d2ad. Report an issue: GitHub.