{"record":{"id":"eecc8c7f4cf5fbf6","repo":"paperclipai/paperclip","slug":"could-not-resolve-worktree-selector-use-a-pa","errorCode":null,"errorMessage":"Could not resolve worktree \"${selector}\". Use a path, a listed worktree directory name, branch name, or \"current\".","messagePattern":"Could not resolve worktree \"(.+?)\"\\. Use a path, a listed worktree directory name, branch name, or \"current\"\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/worktree.ts","lineNumber":3675,"sourceCode":"    if (!existsSync(configPath)) {\n      throw new Error(`Resolved worktree path ${directPath} does not contain .paperclip/config.json.`);\n    }\n    return {\n      rootPath: directPath,\n      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,","sourceCodeStart":3657,"sourceCodeEnd":3693,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/cli/src/commands/worktree.ts#L3657-L3693","documentation":"Resolution-failure sentinel for worktree selectors: the value matched neither an existing filesystem path, a listed worktree directory name, nor a known branch label (and was not 'current'), so no endpoint could be resolved.","triggerScenarios":"Thrown at cli/src/commands/worktree.ts:2860 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a path, a listed worktree directory name, a branch name, or \"current\".","Run `paperclipai worktree:list` to see valid selectors."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}