paperclipai/paperclip · error · Error

Worktree seed manifest target instance does not match the re

Error message

Worktree seed manifest target instance does not match the registered target instance.

What it means

The optional manifestTargetInstanceId field, when compared against the target instance id resolved from the target worktree config, does not match. The manifest claims the worktree belongs to a different target instance than its config actually names, so the manifest's assertion about the target is stale or wrong.

Source

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

  const registered = resolveRegisteredWorktreeSeedSource(input);
  const diagnosticPath = typeof input.manifestSource?.configPath === "string"
    ? input.manifestSource.configPath.trim()
    : "";
  if (!diagnosticPath) {
    throw new Error("Worktree seed manifest is missing source path diagnostics.");
  }
  const canonicalDiagnosticPath = canonicalRegularFile(
    diagnosticPath,
    "Worktree seed manifest source diagnostic",
  );
  if (path.resolve(diagnosticPath) !== registered.configPath || canonicalDiagnosticPath !== registered.configPath) {
    throw new Error("Worktree seed manifest source path does not match the registered canonical source.");
  }
  if (input.manifestSource?.instanceId !== registered.instanceId) {
    throw new Error("Worktree seed manifest source instance does not match the registered source instance.");
  }
  if (input.manifestTargetInstanceId !== registered.targetInstanceId) {
    throw new Error("Worktree seed manifest target instance does not match the registered target instance.");
  }
  return registered;
}

View on GitHub (pinned to a7e689b3c3)

Solutions

  1. Compare the manifest's target instance id with `grep PAPERCLIP_INSTANCE_ID <target>/.paperclip/.env`.
  2. Update the manifest field to the target's actual instance id, or regenerate the manifest.
  3. If the worktree was migrated intentionally, refresh every manifest field (source path, source id, target id) in one pass.

Example fix

// before
{ "source": {...}, "targetInstanceId": "old-target-id" }

// after
{ "source": {...}, "targetInstanceId": "<id from target worktree .paperclip/.env>" }
Defensive patterns

Strategy: validation

Validate before calling

const currentTargetId = instanceIdFromEnv(targetConfigPath);
if (manifest.targetInstanceId !== undefined && manifest.targetInstanceId !== currentTargetId) {
  throw new Error("manifest target instance id is stale — regenerate the manifest");
}

Prevention

When it happens

Trigger: resolveCanonicalWorktreeSeedSource with input.manifestTargetInstanceId set to a value different from readInstanceId(targetConfig) — e.g. worktree migrated to a new instance without updating the manifest, or a manifest copied from another worktree.

Common situations: Worktree moved between instances; target .env regenerated with a new instance id while the manifest kept the old one; manifest templates filled with placeholder ids.

Related errors


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