{"record":{"id":"1216de889eaffefc","repo":"paperclipai/paperclip","slug":"resolved-worktree-selector-does-not-look-like","errorCode":null,"errorMessage":"Resolved worktree \"${selector}\" does not look like a Paperclip worktree.","messagePattern":"Resolved worktree \"(.+?)\" does not look like a Paperclip worktree\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/worktree.ts","lineNumber":2865,"sourceCode":"      configPath,\n      label: path.basename(directPath),\n      isCurrent: false,\n    };\n  }\n\n  const matched = choices.find((choice) =>\n    (allowCurrent || !choice.isCurrent)\n    && (choice.worktree === directPath\n      || path.basename(choice.worktree) === trimmed\n      || choice.branchLabel === trimmed),\n  );\n  if (!matched) {\n    throw new Error(\n      `Could not resolve worktree \"${selector}\". Use a path, a listed worktree directory name, branch name, or \"current\".`,\n    );\n  }\n  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  }","sourceCodeStart":2847,"sourceCodeEnd":2883,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/cli/src/commands/worktree.ts#L2847-L2883","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","solutions":["Initialize Paperclip in that worktree: `cd <matched-worktree> && paperclipai worktree:init`.","Pick a different selector that maps to a worktree WITH a Paperclip config (use `worktree:list` and look for the 'paperclip' flag).","Restore the missing .paperclip/config.json if it was accidentally deleted."],"exampleFix":"// before\npaperclipai worktree:merge-history --source plain-wt   # matched but no Paperclip config\n// after\ncd $(paperclipai worktree:list | pick a 'paperclip'-flagged dir)\npaperclipai worktree:merge-history --source <that-dir>\n# or initialize the plain worktree\ncd <plain-wt-path> && paperclipai worktree:init","handlingStrategy":"validation","validationCode":"const matched = choices.find(/* ... */);\nif (matched && !matched.hasPaperclipConfig && !matched.isCurrent) {\n  throw new Error(`${selector} matched a non-Paperclip worktree; run worktree:init there`);\n}","typeGuard":"function matchedIsPaperclipWorktree(c: MergeSourceChoice): boolean {\n  return c.hasPaperclipConfig || c.isCurrent;\n}","tryCatchPattern":"try { resolveWorktreeEndpointFromSelector(selector); }\ncatch (err) {\n  if (/does not look like a Paperclip worktree/.test(String((err as Error).message))) {\n    // init that worktree or choose another selector\n  } else throw err;\n}","preventionTips":["Initialize every worktree you intend to merge with `worktree:init`.","Use `worktree:list` and prefer entries flagged 'paperclip'.","Avoid deleting the .paperclip directory from worktrees."],"tags":["worktree","validation","config","git"],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}