paperclipai/paperclip · error · Error

Target config not found at ${targetEndpoint.configPath}.

Error message

Target config not found at ${targetEndpoint.configPath}.

What it means

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.

Source

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

  if (!isWorktreeSeedMode(seedMode)) {
    throw new Error(`Unsupported seed mode "${seedMode}". Expected one of: minimal, full.`);
  }

  const targetEndpoint = opts.to
    ? resolveWorktreeEndpointFromSelector(opts.to, { allowCurrent: true })
    : resolveCurrentWorktreeEndpoint();
  const source = resolveWorktreeReseedSource(opts);

  if (path.resolve(source.configPath) === path.resolve(targetEndpoint.configPath)) {
    throw new Error("Source and target Paperclip configs are the same. Choose different --from/--to values.");
  }
  if (!existsSync(source.configPath)) {
    throw new Error(`Source config not found at ${source.configPath}.`);
  }

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

  const targetPaths = resolveWorktreeReseedTargetPaths({
    configPath: targetEndpoint.configPath,
    rootPath: targetEndpoint.rootPath,
  });
  const runningTargetPid = resolveRunningEmbeddedPostgresPid(targetConfig);
  if (runningTargetPid && !opts.allowLiveTarget) {
    throw new Error(
      `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.`,
    );
  }

  const confirmed = opts.yes

View on GitHub (pinned to 67001ec6eb)

Solutions

  1. Run `paperclipai worktree init` in the target worktree first to create .paperclip/config.json.
  2. Verify --to points where you expect: `ls .paperclip/config.json` in that directory.
  3. If the current checkout is not a Paperclip worktree, cd into one that is, or pass --to to an initialized worktree.

Example fix

// before (current dir has no .paperclip/config.json)
paperclipai worktree reseed --from-config src.json
// after
paperclipai worktree init
paperclipai worktree reseed --from-config src.json --seed-mode full
Defensive patterns

Strategy: validation

Validate before calling

import fs from "node:fs";
import path from "node:path";

function ensureTargetConfigExists(targetRoot: string): void {
  const cfg = path.resolve(targetRoot, ".paperclip", "config.json");
  if (!fs.existsSync(cfg)) {
    throw new Error(`Target config not found at ${cfg}. Run \`paperclipai worktree init\` first.`);
  }
}

Prevention

When it happens

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

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

Related errors


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