{"record":{"id":"bd287e603dcd631a","repo":"paperclipai/paperclip","slug":"worktree-selector-cannot-be-empty","errorCode":null,"errorMessage":"Worktree selector cannot be empty.","messagePattern":"Worktree selector cannot be empty\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/worktree.ts","lineNumber":3642,"sourceCode":"  if (choice.isCurrent) {\n    return resolveCurrentWorktreeEndpoint();\n  }\n  return {\n    rootPath: choice.worktree,\n    configPath: path.resolve(choice.worktree, \".paperclip\", \"config.json\"),\n    label: choice.branchLabel,\n    isCurrent: false,\n  };\n}\n\nfunction resolveWorktreeEndpointFromSelector(\n  selector: string,\n  opts?: { allowCurrent?: boolean },\n): ResolvedWorktreeEndpoint {\n  const trimmed = selector.trim();\n  const allowCurrent = opts?.allowCurrent !== false;\n  if (trimmed.length === 0) {\n    throw new Error(\"Worktree selector cannot be empty.\");\n  }\n\n  const currentEndpoint = resolveCurrentWorktreeEndpoint();\n  if (allowCurrent && trimmed === \"current\") {\n    return currentEndpoint;\n  }\n\n  const choices = toMergeSourceChoices(process.cwd());\n  const directPath = path.resolve(trimmed);\n  if (existsSync(directPath)) {\n    if (allowCurrent && directPath === currentEndpoint.rootPath) {\n      return currentEndpoint;\n    }\n    const configPath = path.resolve(directPath, \".paperclip\", \"config.json\");\n    if (!existsSync(configPath)) {\n      throw new Error(`Resolved worktree path ${directPath} does not contain .paperclip/config.json.`);\n    }\n    return {","sourceCodeStart":3624,"sourceCodeEnd":3660,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/cli/src/commands/worktree.ts#L3624-L3660","documentation":"Required-argument guard in worktree selector resolution: the selector string is empty after trimming, so there is no path, directory name, branch, or 'current' keyword to resolve a worktree endpoint from.","triggerScenarios":"Thrown at cli/src/commands/worktree.ts:2827 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass an absolute or relative path to the worktree root directory","Pass the worktree directory name under the worktrees home","Pass the worktree's git branch label","Pass the literal keyword \"current\" to target the worktree containing the current directory","Run paperclipai worktree:list first 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"}