paperclipai/paperclip · error · Error

Target config not found at ${configPath}.

Error message

Target config not found at ${configPath}.

What it means

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.

Source

Thrown at cli/src/commands/worktree.ts:1591

          fromConfig: opts.fromConfig,
          fromDataDir: opts.fromDataDir,
          fromInstance: opts.fromInstance,
        })
      : path.resolve(pending.sourceConfigPath);

    if (path.resolve(sourceConfigPath) === path.resolve(configPath)) {
      throw new Error(
        "Source and target Paperclip configs are the same. Pass --from-config for the source instance.",
      );
    }

    const sourceConfig = readConfig(sourceConfigPath);
    if (!sourceConfig) {
      throw new Error(`Source config not found at ${sourceConfigPath}.`);
    }
    const targetConfig = readConfig(configPath);
    if (!targetConfig) {
      throw new Error(`Target config not found at ${configPath}.`);
    }

    const targetRoot = path.dirname(path.dirname(configPath));
    const targetPaths = resolveWorktreeReseedTargetPaths({ configPath, rootPath: targetRoot });
    const seedDatabase = dependencies.seedDatabase ?? seedWorktreeDatabase;
    const details = await seedDatabase({
      sourceConfigPath,
      sourceConfig,
      targetConfig,
      targetPaths,
      instanceId: targetPaths.instanceId,
      seedMode: "minimal",
      preserveLiveWork: opts.preserveLiveWork,
    });
    markWorktreeSeedComplete({ configPath });
    return { seeded: true, reason: "seeded", details };
  } finally {
    await releaseLock();

View on GitHub (pinned to 67001ec6eb)

Solutions

  1. Confirm the worktree config exists: `ls <worktree>/.paperclip/config.json`.
  2. If missing, re-run `paperclipai worktree:init` in the worktree directory to regenerate the target config before seeding.
  3. Check the --config / target path argument for typos and that it is absolute or correctly relative to cwd.
  4. If the config file is corrupt, delete it and re-init.

Example fix

// before
paperclipai worktree:seed --config ./wrong-path/config.json
// after
cd /path/to/worktree && paperclipai worktree:init   # regenerate target config
paperclipai worktree:seed --from-config /source/.paperclip/config.json
Defensive patterns

Strategy: validation

Validate before calling

const targetCfg = readConfig(configPath);
if (!targetCfg) {
  throw new Error(`Target config missing; run worktree:init first at ${configPath}`);
}

Type guard

function targetConfigExists(p: string): boolean {
  return existsSync(p) && readConfig(p) != null;
}

Try / catch

try { await ensureWorktreeSeeded(opts); }
catch (err) {
  if (/Target config not found/.test(String((err as Error).message))) {
    // re-init the target worktree
  } else throw err;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of paperclipai/paperclip@67001ec6eb (2026-08-12). Data as JSON: /api/errors/ba2d44e1358aa745. Report an issue: GitHub.