{"record":{"id":"9e0be3da0f5885f3","repo":"paperclipai/paperclip","slug":"worktree-seed-manifest-source-path-does-not-match","errorCode":null,"errorMessage":"Worktree seed manifest source path does not match the registered canonical source.","messagePattern":"Worktree seed manifest source path does not match the registered canonical source\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/shared/src/worktree-seed-source.ts","lineNumber":218,"sourceCode":" * never select the returned source.\n */\nexport function resolveCanonicalWorktreeSeedSource(input: RegisteredWorktreeSeedSourceInput & {\n  manifestSource: WorktreeSeedSourceDiagnostic | null | undefined;\n  manifestTargetInstanceId?: unknown;\n}): CanonicalWorktreeSeedSource {\n  const registered = resolveRegisteredWorktreeSeedSource(input);\n  const diagnosticPath = typeof input.manifestSource?.configPath === \"string\"\n    ? input.manifestSource.configPath.trim()\n    : \"\";\n  if (!diagnosticPath) {\n    throw new Error(\"Worktree seed manifest is missing source path diagnostics.\");\n  }\n  const canonicalDiagnosticPath = canonicalRegularFile(\n    diagnosticPath,\n    \"Worktree seed manifest source diagnostic\",\n  );\n  if (path.resolve(diagnosticPath) !== registered.configPath || canonicalDiagnosticPath !== registered.configPath) {\n    throw new Error(\"Worktree seed manifest source path does not match the registered canonical source.\");\n  }\n  if (input.manifestSource?.instanceId !== registered.instanceId) {\n    throw new Error(\"Worktree seed manifest source instance does not match the registered source instance.\");\n  }\n  if (input.manifestTargetInstanceId !== registered.targetInstanceId) {\n    throw new Error(\"Worktree seed manifest target instance does not match the registered target instance.\");\n  }\n  return registered;\n}\n","sourceCodeStart":200,"sourceCodeEnd":228,"githubUrl":"https://github.com/paperclipai/paperclip/blob/a7e689b3c35347b529cb9f54c9b9a8575a3dcab6/packages/shared/src/worktree-seed-source.ts#L200-L228","documentation":"The manifest's diagnostic configPath must both resolve (path.resolve) and canonicalize (realpath + symlink/file checks via canonicalRegularFile) to exactly the registered source config path. Either the manifest records a different path than the one the registration resolves to, or the recorded path is a non-canonical alias of it.","triggerScenarios":"manifestSource.configPath differing from `<base>/.paperclip/config.json` after the workspace moved; a manifest recording a symlinked alias (e.g. /tmp/... instead of /private/tmp/...); stale manifests from before a re-registration.","commonSituations":"Workspace moved/re-registered after the manifest was written; macOS /tmp aliasing baked into manifests; manifests shared between machines with different home paths; symlinked `.paperclip` at manifest-creation time.","solutions":["Compare `manifest.source.configPath` with `realpath <base>/.paperclip/config.json` and update the manifest to the canonical value.","Regenerate the seed manifest after moving or re-registering the base workspace.","Never write alias paths into manifests — store `realpath` output."],"exampleFix":"# before: manifest holds a stale path\n\"source\": { \"configPath\": \"/home/me/old-loc/base/.paperclip/config.json\" }\n\n# after: regenerate or edit to the current canonical path\n\"source\": { \"configPath\": \"$(realpath ~/code/base/.paperclip/config.json)\" }","handlingStrategy":"validation","validationCode":"import { realpathSync } from \"node:fs\";\nimport path from \"node:path\";\n\nconst registered = path.join(baseWorkspaceCwd, \".paperclip\", \"config.json\");\nconst recorded = manifest.source.configPath;\nif (path.resolve(recorded) !== registered || realpathSync(recorded) !== registered) {\n  throw new Error(\"manifest source path is stale — regenerate the manifest\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Store realpath output when writing manifests; never raw or aliased paths.","Regenerate manifests after moving or re-registering a workspace.","Include manifest generation in the same commit/step as registration changes."],"tags":["manifest","worktree-seed","path-canonicalization","stale-state"],"backgroundTag":"manifest-path-mismatch","analyzedSha":"a7e689b3c35347b529cb9f54c9b9a8575a3dcab6","analyzedAt":"2026-08-21T17:58:32.592Z","contentChangedAt":"2026-08-21T17:58:32.592Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}