{"record":{"id":"2742d0014ff88879","repo":"paperclipai/paperclip","slug":"resolved-worktree-path-directpath-does-not-cont","errorCode":null,"errorMessage":"Resolved worktree path ${directPath} does not contain .paperclip/config.json.","messagePattern":"Resolved worktree path (.+?) does not contain \\.paperclip/config\\.json\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/worktree.ts","lineNumber":2843,"sourceCode":"  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 {\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\".`,","sourceCodeStart":2825,"sourceCodeEnd":2861,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/cli/src/commands/worktree.ts#L2825-L2861","documentation":"Thrown by resolveWorktreeEndpointFromSelector when the selector resolves to an existing directory (existsSync true) but that directory has no .paperclip/config.json. Because the path exists as a real directory, the resolver treats it as a direct path target — and requires a Paperclip config inside it. Without the config it cannot be a merge/seed endpoint.","triggerScenarios":"Passing a path to a plain git worktree that was never initialized as a Paperclip worktree; pointing at an arbitrary directory; the .paperclip dir was deleted from an otherwise valid worktree.","commonSituations":"Created a git worktree manually (`git worktree add`) without running `worktree:init`; wrong directory passed as source; .paperclip wiped by git clean.","solutions":["Initialize Paperclip in that directory first: `cd <path> && paperclipai worktree:init`.","Point the selector at a directory that already has .paperclip/config.json (run `worktree:list` to find valid ones).","If you meant a branch/dir NAME rather than a path, ensure the value doesn't resolve to an existing config-less directory."],"exampleFix":"// before\npaperclipai worktree:merge-history --source /path/to/plain-worktree\n# /path/to/plain-worktree has no .paperclip/config.json\n// after\ncd /path/to/plain-worktree && paperclipai worktree:init\npaperclipai worktree:merge-history --source /path/to/plain-worktree","handlingStrategy":"validation","validationCode":"const cfgPath = path.resolve(directPath, \".paperclip\", \"config.json\");\nif (!existsSync(cfgPath)) throw new Error(`${directPath} is not a Paperclip worktree; run worktree:init`);","typeGuard":"function dirIsPaperclipWorktree(dir: string): boolean {\n  return existsSync(path.resolve(dir, \".paperclip\", \"config.json\"));\n}","tryCatchPattern":"try { resolveWorktreeEndpointFromSelector(selector); }\ncatch (err) {\n  if (/does not contain .paperclip\\/config.json/.test(String((err as Error).message))) {\n    // init Paperclip there, or pick a different selector\n  } else throw err;\n}","preventionTips":["Use `worktree:list` to find directories flagged as Paperclip worktrees.","Run `worktree:init` in any plain git worktree before referencing it."],"tags":["worktree","validation","config","filesystem"],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}