{"record":{"id":"530430ba3c28d406","repo":"paperclipai/paperclip","slug":"target-config-not-found-at-targetendpoint-config","errorCode":null,"errorMessage":"Target config not found at ${targetEndpoint.configPath}.","messagePattern":"Target config not found at (.+?)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/worktree.ts","lineNumber":3418,"sourceCode":"  if (!isWorktreeSeedMode(seedMode)) {\n    throw new Error(`Unsupported seed mode \"${seedMode}\". Expected one of: minimal, full.`);\n  }\n\n  const targetEndpoint = opts.to\n    ? resolveWorktreeEndpointFromSelector(opts.to, { allowCurrent: true })\n    : resolveCurrentWorktreeEndpoint();\n  const source = resolveWorktreeReseedSource(opts);\n\n  if (path.resolve(source.configPath) === path.resolve(targetEndpoint.configPath)) {\n    throw new Error(\"Source and target Paperclip configs are the same. Choose different --from/--to values.\");\n  }\n  if (!existsSync(source.configPath)) {\n    throw new Error(`Source config not found at ${source.configPath}.`);\n  }\n\n  const targetConfig = readConfig(targetEndpoint.configPath);\n  if (!targetConfig) {\n    throw new Error(`Target config not found at ${targetEndpoint.configPath}.`);\n  }\n  const sourceConfig = readConfig(source.configPath);\n  if (!sourceConfig) {\n    throw new Error(`Source config not found at ${source.configPath}.`);\n  }\n\n  const targetPaths = resolveWorktreeReseedTargetPaths({\n    configPath: targetEndpoint.configPath,\n    rootPath: targetEndpoint.rootPath,\n  });\n  const runningTargetPid = resolveRunningEmbeddedPostgresPid(targetConfig);\n  if (runningTargetPid && !opts.allowLiveTarget) {\n    throw new Error(\n      `Target worktree database appears to be running (pid ${runningTargetPid}). Stop Paperclip in ${targetEndpoint.rootPath} before reseeding, or re-run with --allow-live-target if you want to override this guard.`,\n    );\n  }\n\n  const confirmed = opts.yes","sourceCodeStart":3400,"sourceCodeEnd":3436,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/cli/src/commands/worktree.ts#L3400-L3436","documentation":"Thrown by runWorktreeReseed when readConfig(targetEndpoint.configPath) returns null, meaning the target worktree has no readable .paperclip/config.json. The target endpoint comes from --to (or defaults to current). readConfig returns null only when fs.existsSync(filePath) is false, so this means the target was never initialized as a Paperclip worktree. Note the source-missing check (248) runs first, so this specifically indicts the target side.","triggerScenarios":"Calling reseed with --to <worktree> (or running from a current checkout) whose .paperclip/config.json does not exist. Commonly the current directory is a plain git worktree that never ran `paperclipai worktree init`.","commonSituations":"A developer clones the repo, creates a worktree, and immediately tries to reseed it without initializing Paperclip first. Or the target's .paperclip dir was deleted.","solutions":["Run `paperclipai worktree init` in the target worktree first to create .paperclip/config.json.","Verify --to points where you expect: `ls .paperclip/config.json` in that directory.","If the current checkout is not a Paperclip worktree, cd into one that is, or pass --to to an initialized worktree."],"exampleFix":"// before (current dir has no .paperclip/config.json)\npaperclipai worktree reseed --from-config src.json\n// after\npaperclipai worktree init\npaperclipai worktree reseed --from-config src.json --seed-mode full","handlingStrategy":"validation","validationCode":"import fs from \"node:fs\";\nimport path from \"node:path\";\n\nfunction ensureTargetConfigExists(targetRoot: string): void {\n  const cfg = path.resolve(targetRoot, \".paperclip\", \"config.json\");\n  if (!fs.existsSync(cfg)) {\n    throw new Error(`Target config not found at ${cfg}. Run \\`paperclipai worktree init\\` first.`);\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run `paperclipai worktree init` in the target worktree before any reseed attempt.","In scripts, verify .paperclip/config.json exists in the target directory before calling reseed."],"tags":["worktree","cli","reseed","config","file-not-found"],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}