{"record":{"id":"45eadc9446d67f9c","repo":"paperclipai/paperclip","slug":"source-and-target-paperclip-configs-are-the-same-45eadc","errorCode":null,"errorMessage":"Source and target Paperclip configs are the same. Use --from-config/--from-instance to point repair at a different source.","messagePattern":"Source and target Paperclip configs are the same\\. Use --from-config/--from-instance to point repair at a different source\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/worktree.ts","lineNumber":3519,"sourceCode":"  }\n\n  const target = await ensureRepairTargetWorktree({\n    selector: nonEmpty(opts.branch) ?? undefined,\n    seedMode,\n    opts,\n  });\n  if (!target) {\n    p.log.warn(\"Current checkout is the primary repo worktree. Pass --branch to create or repair a linked worktree.\");\n    p.outro(pc.yellow(\"No worktree repaired.\"));\n    return;\n  }\n\n  const source = resolveWorktreeRepairSource(opts);\n  if (!existsSync(source.configPath)) {\n    throw new Error(`Source config not found at ${source.configPath}.`);\n  }\n  if (path.resolve(source.configPath) === path.resolve(target.configPath)) {\n    throw new Error(\"Source and target Paperclip configs are the same. Use --from-config/--from-instance to point repair at a different source.\");\n  }\n\n  const targetConfig = existsSync(target.configPath) ? readConfig(target.configPath) : null;\n  const targetEnvEntries = readPaperclipEnvEntries(resolvePaperclipEnvFile(target.configPath));\n  const targetHasWorktreeEnv = Boolean(\n    nonEmpty(targetEnvEntries.PAPERCLIP_HOME) && nonEmpty(targetEnvEntries.PAPERCLIP_INSTANCE_ID),\n  );\n\n  if (targetConfig && targetHasWorktreeEnv && opts.noSeed) {\n    p.log.message(pc.dim(`Target ${target.label} already has worktree-local config/env. Skipping reseed because --no-seed was passed.`));\n    p.outro(pc.green(`Worktree metadata already looks healthy for ${target.label}.`));\n    return;\n  }\n\n  if (targetConfig && targetHasWorktreeEnv) {\n    await runWorktreeReseed({\n      fromConfig: source.configPath,\n      to: target.rootPath,","sourceCodeStart":3501,"sourceCodeEnd":3537,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/cli/src/commands/worktree.ts#L3501-L3537","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","solutions":["Point --from-config / --from-data-dir / --from-instance at a different source instance than the one backing the target.","Inspect the target's .paperclip/.env (PAPERCLIP_INSTANCE_ID) and pick a source whose instance id differs."],"exampleFix":"// before (source resolves to same instance as target)\npaperclipai worktree repair --branch feature-x --from-instance default\n// after\npaperclipai worktree repair --branch feature-x --from-config ~/.paperclip/instances/primary/config.json","handlingStrategy":"validation","validationCode":"import path from \"node:path\";\n\nfunction validateRepairDistinct(sourceConfigPath: string, targetConfigPath: string): void {\n  if (path.resolve(sourceConfigPath) === path.resolve(targetConfigPath)) {\n    throw new Error(\"Source and target Paperclip configs are the same. Use --from-config/--from-instance to point repair at a different source.\");\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Read the target's PAPERCLIP_INSTANCE_ID from .paperclip/.env and choose a source instance with a different id.","Pass --from-config explicitly rather than relying on the default instance when repairing a worktree that itself uses the default instance."],"tags":["worktree","cli","repair","validation"],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}