paperclipai/paperclip · error · Error

Source and target Paperclip configs are the same. Use --from

Error message

Source and target Paperclip configs are the same. Use --from-config/--from-instance to point repair at a different source.

What it means

Thrown by worktreeRepairCommand when path.resolve(source.configPath) === path.resolve(target.configPath). Repair is meant to copy/seed a target worktree from a different source instance; using the same config on both sides is rejected. The message specifically names --from-config/--from-instance because repair's source resolver always derives from those (or the default instance), never from the current checkout directly.

Source

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

  }

  const target = await ensureRepairTargetWorktree({
    selector: nonEmpty(opts.branch) ?? undefined,
    seedMode,
    opts,
  });
  if (!target) {
    p.log.warn("Current checkout is the primary repo worktree. Pass --branch to create or repair a linked worktree.");
    p.outro(pc.yellow("No worktree repaired."));
    return;
  }

  const source = resolveWorktreeRepairSource(opts);
  if (!existsSync(source.configPath)) {
    throw new Error(`Source config not found at ${source.configPath}.`);
  }
  if (path.resolve(source.configPath) === path.resolve(target.configPath)) {
    throw new Error("Source and target Paperclip configs are the same. Use --from-config/--from-instance to point repair at a different source.");
  }

  const targetConfig = existsSync(target.configPath) ? readConfig(target.configPath) : null;
  const targetEnvEntries = readPaperclipEnvEntries(resolvePaperclipEnvFile(target.configPath));
  const targetHasWorktreeEnv = Boolean(
    nonEmpty(targetEnvEntries.PAPERCLIP_HOME) && nonEmpty(targetEnvEntries.PAPERCLIP_INSTANCE_ID),
  );

  if (targetConfig && targetHasWorktreeEnv && opts.noSeed) {
    p.log.message(pc.dim(`Target ${target.label} already has worktree-local config/env. Skipping reseed because --no-seed was passed.`));
    p.outro(pc.green(`Worktree metadata already looks healthy for ${target.label}.`));
    return;
  }

  if (targetConfig && targetHasWorktreeEnv) {
    await runWorktreeReseed({
      fromConfig: source.configPath,
      to: target.rootPath,

View on GitHub (pinned to 67001ec6eb)

Solutions

  1. Point --from-config / --from-data-dir / --from-instance at a different source instance than the one backing the target.
  2. Inspect the target's .paperclip/.env (PAPERCLIP_INSTANCE_ID) and pick a source whose instance id differs.

Example fix

// before (source resolves to same instance as target)
paperclipai worktree repair --branch feature-x --from-instance default
// after
paperclipai worktree repair --branch feature-x --from-config ~/.paperclip/instances/primary/config.json
Defensive patterns

Strategy: validation

Validate before calling

import path from "node:path";

function validateRepairDistinct(sourceConfigPath: string, targetConfigPath: string): void {
  if (path.resolve(sourceConfigPath) === path.resolve(targetConfigPath)) {
    throw new Error("Source and target Paperclip configs are the same. Use --from-config/--from-instance to point repair at a different source.");
  }
}

Prevention

When it happens

Trigger: Calling repair where the resolved source config equals the target worktree's config: e.g. --from-instance <id> where <id> is the same instance the target worktree uses, or --from-config pointing at the target's own .paperclip/config.json.

Common situations: A developer passes --from-config with the target's config path by mistake. Or the target worktree was initialized from the default instance and repair is run with the default source (same instance id).

Related errors


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