{"record":{"id":"ba2d44e1358aa745","repo":"paperclipai/paperclip","slug":"target-config-not-found-at-configpath","errorCode":null,"errorMessage":"Target config not found at ${configPath}.","messagePattern":"Target config not found at (.+?)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/worktree.ts","lineNumber":1591,"sourceCode":"          fromConfig: opts.fromConfig,\n          fromDataDir: opts.fromDataDir,\n          fromInstance: opts.fromInstance,\n        })\n      : path.resolve(pending.sourceConfigPath);\n\n    if (path.resolve(sourceConfigPath) === path.resolve(configPath)) {\n      throw new Error(\n        \"Source and target Paperclip configs are the same. Pass --from-config for the source instance.\",\n      );\n    }\n\n    const sourceConfig = readConfig(sourceConfigPath);\n    if (!sourceConfig) {\n      throw new Error(`Source config not found at ${sourceConfigPath}.`);\n    }\n    const targetConfig = readConfig(configPath);\n    if (!targetConfig) {\n      throw new Error(`Target config not found at ${configPath}.`);\n    }\n\n    const targetRoot = path.dirname(path.dirname(configPath));\n    const targetPaths = resolveWorktreeReseedTargetPaths({ configPath, rootPath: targetRoot });\n    const seedDatabase = dependencies.seedDatabase ?? seedWorktreeDatabase;\n    const details = await seedDatabase({\n      sourceConfigPath,\n      sourceConfig,\n      targetConfig,\n      targetPaths,\n      instanceId: targetPaths.instanceId,\n      seedMode: \"minimal\",\n      preserveLiveWork: opts.preserveLiveWork,\n    });\n    markWorktreeSeedComplete({ configPath });\n    return { seeded: true, reason: \"seeded\", details };\n  } finally {\n    await releaseLock();","sourceCodeStart":1573,"sourceCodeEnd":1609,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/cli/src/commands/worktree.ts#L1573-L1609","documentation":"Thrown by ensureWorktreeSeeded when the TARGET (worktree) config itself cannot be read via readConfig(configPath). The target is the worktree's own .paperclip/config.json, which must already exist because seeding writes INTO its database. A null return means the file is missing or unparseable at the moment seeding is attempted.","triggerScenarios":"Running `worktree:seed` against a path that was never initialized with `worktree:init`; the worktree's .paperclip/config.json was deleted or corrupted between init and seed; passing a --config path that points at a nonexistent file; the worktree checkout was reset/cleaned, removing untracked config.","commonSituations":"User ran `git clean -fdx` or `git stash` in the worktree, wiping the untracked .paperclip dir; initialized with --no-seed then manually deleted config.json; pointing the merge/seed command at the wrong worktree directory.","solutions":["Confirm the worktree config exists: `ls <worktree>/.paperclip/config.json`.","If missing, re-run `paperclipai worktree:init` in the worktree directory to regenerate the target config before seeding.","Check the --config / target path argument for typos and that it is absolute or correctly relative to cwd.","If the config file is corrupt, delete it and re-init."],"exampleFix":"// before\npaperclipai worktree:seed --config ./wrong-path/config.json\n// after\ncd /path/to/worktree && paperclipai worktree:init   # regenerate target config\npaperclipai worktree:seed --from-config /source/.paperclip/config.json","handlingStrategy":"validation","validationCode":"const targetCfg = readConfig(configPath);\nif (!targetCfg) {\n  throw new Error(`Target config missing; run worktree:init first at ${configPath}`);\n}","typeGuard":"function targetConfigExists(p: string): boolean {\n  return existsSync(p) && readConfig(p) != null;\n}","tryCatchPattern":"try { await ensureWorktreeSeeded(opts); }\ncatch (err) {\n  if (/Target config not found/.test(String((err as Error).message))) {\n    // re-init the target worktree\n  } else throw err;\n}","preventionTips":["Always run `worktree:init` (or `worktree:make`) before `worktree:seed` in a given worktree.","Avoid `git clean -fdx` or stashing that removes the untracked .paperclip directory.","Pin the --config argument to an absolute path."],"tags":["worktree","config","seeding","filesystem"],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}