paperclipai/paperclip · error · Error

Source and target Paperclip configs name the same instance.

Error message

Source and target Paperclip configs name the same instance.

What it means

Source and target configs are distinct files (checked just before), but the instance ids read from them are equal. Seeding exists to copy state from one instance into a different one; two configs naming the same instance would fold the worktree back onto its own instance, so the resolver rejects it.

Source

Thrown at packages/shared/src/worktree-seed-source.ts:180

      throw new Error("Explicit source Paperclip config does not match the registered base project workspace.");
    }
  }

  const canonicalTargetConfigPath = canonicalRegularFile(
    input.targetConfigPath,
    "Target worktree Paperclip config",
  );
  if (canonicalSourceConfigPath === canonicalTargetConfigPath) {
    throw new Error("Source and target Paperclip configs are the same canonical file.");
  }

  const sourceInstanceId = readInstanceId(canonicalSourceConfigPath, "source");
  const targetInstanceId = readInstanceId(canonicalTargetConfigPath, "target");
  if (targetInstanceId !== input.expectedTargetInstanceId) {
    throw new Error("Target Paperclip instance does not match the registered worktree instance.");
  }
  if (sourceInstanceId === targetInstanceId) {
    throw new Error("Source and target Paperclip configs name the same instance.");
  }

  return {
    baseWorkspaceCwd: canonicalBaseCwd,
    configPath: canonicalSourceConfigPath,
    instanceId: sourceInstanceId,
    targetConfigPath: canonicalTargetConfigPath,
    targetInstanceId,
  };
}

/**
 * Resolve a worktree seed source without granting authority to the seed manifest.
 *
 * A managed caller supplies the project-workspace cwd from its server-owned row.
 * An operator may instead supply an explicit source config. A base workspace that
 * carries its own `.paperclip/config.json` stays authoritative, so an explicit path
 * must equal it; a base workspace that is a plain checkout has none, and the explicit

View on GitHub (pinned to a7e689b3c3)

Solutions

  1. Compare `PAPERCLIP_INSTANCE_ID` in `<source>/.env` and `<target>/.paperclip/.env` — they must differ.
  2. Re-issue the target worktree's config/.env with its own new instance id (re-create the worktree via the managed flow rather than copying).
  3. Add `.paperclip/` to copy/rsync excludes when duplicating workspaces.

Example fix

# before
cp -a base worktrees/issue-42   # copies .paperclip/.env with the same instance id

# after
cp -a --exclude=.paperclip base worktrees/issue-42   # then let paperclip issue the worktree's own config
Defensive patterns

Strategy: validation

Validate before calling

const ids = new Set<string>();
for (const cfg of [sourceConfigPath, targetConfigPath]) {
  const id = instanceIdFromEnv(cfg); // helper reading PAPERCLIP_INSTANCE_ID
  if (id) {
    if (ids.has(id)) throw new Error("source and target share one instance id");
    ids.add(id);
  }
}

Prevention

When it happens

Trigger: A target worktree config (and its adjacent .env) copied wholesale from the base workspace, so PAPERCLIP_INSTANCE_ID matches the source; instance-root configs whose instances/<id> directory names collide between source and target.

Common situations: Cloning a worktree or base directory including `.paperclip/` (cp -a, rsync without exclude); templates that ship a pre-baked .env; forgetting that the worktree must get a fresh instance id before seeding.

Related errors


AI-assisted analysis of paperclipai/paperclip@a7e689b3c3 (2026-08-21). Data as JSON: /api/errors/868adc0fdd99a1c0. Report an issue: GitHub.