paperclipai/paperclip · error · Error

Resolved worktree "${selector}" does not look like a Papercl

Error message

Resolved worktree "${selector}" does not look like a Paperclip worktree.

What it means

Thrown by resolveWorktreeEndpointFromSelector when the selector DID match a listed git worktree (by dir, basename, or branch label) BUT that worktree has no Paperclip config (hasPaperclipConfig false) and is not the current checkout. Matching a non-Paperclip git worktree is treated as an error because merge/seed operations require a Paperclip config to open the instance DB. This distinguishes 'found a git worktree, but it's not a Paperclip worktree' from error 238 (found nothing).

Source

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

      configPath,
      label: path.basename(directPath),
      isCurrent: false,
    };
  }

  const matched = choices.find((choice) =>
    (allowCurrent || !choice.isCurrent)
    && (choice.worktree === directPath
      || path.basename(choice.worktree) === trimmed
      || choice.branchLabel === trimmed),
  );
  if (!matched) {
    throw new Error(
      `Could not resolve worktree "${selector}". Use a path, a listed worktree directory name, branch name, or "current".`,
    );
  }
  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.");
  }

View on GitHub (pinned to 67001ec6eb)

Solutions

  1. Initialize Paperclip in that worktree: `cd <matched-worktree> && paperclipai worktree:init`.
  2. Pick a different selector that maps to a worktree WITH a Paperclip config (use `worktree:list` and look for the 'paperclip' flag).
  3. Restore the missing .paperclip/config.json if it was accidentally deleted.

Example fix

// before
paperclipai worktree:merge-history --source plain-wt   # matched but no Paperclip config
// after
cd $(paperclipai worktree:list | pick a 'paperclip'-flagged dir)
paperclipai worktree:merge-history --source <that-dir>
# or initialize the plain worktree
cd <plain-wt-path> && paperclipai worktree:init
Defensive patterns

Strategy: validation

Validate before calling

const matched = choices.find(/* ... */);
if (matched && !matched.hasPaperclipConfig && !matched.isCurrent) {
  throw new Error(`${selector} matched a non-Paperclip worktree; run worktree:init there`);
}

Type guard

function matchedIsPaperclipWorktree(c: MergeSourceChoice): boolean {
  return c.hasPaperclipConfig || c.isCurrent;
}

Try / catch

try { resolveWorktreeEndpointFromSelector(selector); }
catch (err) {
  if (/does not look like a Paperclip worktree/.test(String((err as Error).message))) {
    // init that worktree or choose another selector
  } else throw err;
}

Prevention

When it happens

Trigger: Selecting a plain git worktree (created via `git worktree add`, never initialized with Paperclip) by name/branch; a worktree whose .paperclip/config.json was deleted; selecting a sibling worktree from another tool.

Common situations: Repo has mixed worktrees (some Paperclip, some plain git); .paperclip dir removed from a previously-valid worktree; pointing at a worktree created before Paperclip was set up.

Related errors


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