{"record":{"id":"bdc16073a125d2ad","repo":"paperclipai/paperclip","slug":"no-paperclip-worktrees-were-found-run-paperclipa","errorCode":null,"errorMessage":"No Paperclip worktrees were found. Run `paperclipai worktree:list` to inspect the repo worktrees.","messagePattern":"No Paperclip worktrees were found\\. Run `paperclipai worktree:list` to inspect the repo worktrees\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/worktree.ts","lineNumber":2882,"sourceCode":"  if (!matched.hasPaperclipConfig && !matched.isCurrent) {\n    throw new Error(`Resolved worktree \"${selector}\" does not look like a Paperclip worktree.`);\n  }\n  return resolveEndpointFromChoice(matched);\n}\n\nasync function promptForSourceEndpoint(excludeWorktreePath?: string): Promise<ResolvedWorktreeEndpoint> {\n  const excluded = excludeWorktreePath ? path.resolve(excludeWorktreePath) : null;\n  const currentEndpoint = resolveCurrentWorktreeEndpoint();\n  const choices = toMergeSourceChoices(process.cwd())\n    .filter((choice) => choice.hasPaperclipConfig || choice.isCurrent)\n    .filter((choice) => path.resolve(choice.worktree) !== excluded)\n    .map((choice) => ({\n      value: choice.isCurrent ? \"__current__\" : choice.worktree,\n      label: choice.branchLabel,\n      hint: `${choice.worktree}${choice.isCurrent ? \" (current)\" : \"\"}`,\n    }));\n  if (choices.length === 0) {\n    throw new Error(\"No Paperclip worktrees were found. Run `paperclipai worktree:list` to inspect the repo worktrees.\");\n  }\n  const selection = await p.select<string>({\n    message: \"Choose the source worktree to import from\",\n    options: choices,\n  });\n  if (p.isCancel(selection)) {\n    throw new Error(\"Source worktree selection cancelled.\");\n  }\n  if (selection === \"__current__\") {\n    return currentEndpoint;\n  }\n  return resolveWorktreeEndpointFromSelector(selection, { allowCurrent: true });\n}\n\nasync function applyMergePlan(input: {\n  sourceStorages: ConfiguredStorage[];\n  targetStorage: ConfiguredStorage;\n  targetDb: ClosableDb;","sourceCodeStart":2864,"sourceCodeEnd":2900,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/cli/src/commands/worktree.ts#L2864-L2900","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Pass --from explicitly with a path or branch that has a Paperclip config.","Run `paperclipai worktree init` in another worktree to make it selectable, then retry.","Run `paperclipai worktree:list` to confirm which worktrees are visible and marked [paperclip].","If you only have one instance, seed it via `worktree reseed --from-config` instead of merge-history."],"exampleFix":"// before\npaperclipai worktree:merge-history\n// after\npaperclipai worktree:merge-history --from /path/to/other-worktree","handlingStrategy":"validation","validationCode":"import { execFileSync } from \"node:child_process\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\n\nfunction countSelectableSources(cwd: string, excludePath?: string): number {\n  const out = execFileSync(\"git\", [\"worktree\", \"list\", \"--porcelain\"], { cwd, encoding: \"utf8\" });\n  const worktrees = out.split(/\\n\\n/).map((b) => b.split(\"\\n\").find((l) => l.startsWith(\"worktree \"))?.slice(9)).filter(Boolean) as string[];\n  return worktrees\n    .filter((w) => w !== excludePath)\n    .filter((w) => fs.existsSync(path.resolve(w, \".paperclip\", \"config.json\"))).length;\n}\n\n// before invoking interactive merge-history:\nif (countSelectableSources(process.cwd()) === 0) {\n  throw new Error(\"No Paperclip-configured source worktrees available; pass --from or run worktree init.\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["In CI/non-TTY contexts, always pass --from explicitly to avoid relying on the interactive picker.","Keep at least one extra Paperclip-initialized worktree if you regularly use interactive merge-history.","Script a pre-check that lists paperclip-configured worktrees before prompting."],"tags":["worktree","cli","merge","validation"],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}