paperclipai/paperclip · error · Error

Worktree seed manifest source instance does not match the re

Error message

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

What it means

The manifest's source.instanceId is compared against the instance id resolved from the registered source config's adjacent .env (or instances/<id> root). A mismatch means the manifest was written against a different source instance than the one the registration currently points at, so its diagnostics no longer describe reality.

Source

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

  manifestSource: WorktreeSeedSourceDiagnostic | null | undefined;
  manifestTargetInstanceId?: unknown;
}): CanonicalWorktreeSeedSource {
  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. Read the current source instance id: `grep PAPERCLIP_INSTANCE_ID <source-config-dir>/.env`.
  2. Update the manifest's `source.instanceId` to that value (or regenerate the manifest).
  3. Clean out stale manifests whenever the base instance is recreated.

Example fix

# before: manifest names the pre-reset instance
"source": { "configPath": "...", "instanceId": "old-id" }

# after
"source": { "configPath": "...", "instanceId": "$(grep -oP '(?<=PAPERCLIP_INSTANCE_ID=).*' <source>/.paperclip/.env)" }
Defensive patterns

Strategy: validation

Validate before calling

const currentSourceId = instanceIdFromEnv(sourceConfigPath); // reads adjacent .env
if (manifest.source.instanceId !== currentSourceId) {
  throw new Error("manifest source instance id is stale — regenerate the manifest");
}

Prevention

When it happens

Trigger: manifestSource.instanceId (missing, hence undefined, or a stale value) vs registered.instanceId from readInstanceId() — e.g. the base workspace's instance was recreated or the manifest was copied from another instance's worktree.

Common situations: Instance reset (`rm -rf` of instance data and re-init) issuing a new id while old manifests remain; manifests copied between worktrees of different instances; partial manifest updates; fixture reuse in tests.

Related errors


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