{"record":{"id":"a525b9d55c3a969e","repo":"paperclipai/paperclip","slug":"invalid-worktree-seed-pending-marker-at-filepath-a525b9","errorCode":null,"errorMessage":"Invalid worktree seed-pending marker at ${filePath}.","messagePattern":"Invalid worktree seed-pending marker at (.+?)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/worktree.ts","lineNumber":1452,"sourceCode":"function readWorktreeSeedPendingMarker(filePath: string): WorktreeSeedPendingMarker {\n  let parsed: unknown;\n  try {\n    parsed = JSON.parse(readFileSync(filePath, \"utf8\"));\n  } catch (error) {\n    throw new Error(\n      `Invalid worktree seed-pending marker at ${filePath}: ${error instanceof Error ? error.message : String(error)}`,\n    );\n  }\n\n  if (\n    !parsed\n    || typeof parsed !== \"object\"\n    || (parsed as { version?: unknown }).version !== 1\n    || (parsed as { state?: unknown }).state !== \"pending\"\n    || typeof (parsed as { sourceConfigPath?: unknown }).sourceConfigPath !== \"string\"\n    || !(parsed as { sourceConfigPath: string }).sourceConfigPath.trim()\n  ) {\n    throw new Error(`Invalid worktree seed-pending marker at ${filePath}.`);\n  }\n\n  return parsed as WorktreeSeedPendingMarker;\n}\n\nconst WORKTREE_SEED_LOCK_POLL_MS = 50;\nconst WORKTREE_SEED_LOCK_MALFORMED_STALE_MS = 60_000;\n\ntype WorktreeSeedLockOwner = {\n  version: 1;\n  pid: number;\n  token: string;\n  createdAt: string;\n};\n\nfunction processIsAlive(pid: number): boolean {\n  try {\n    process.kill(pid, 0);","sourceCodeStart":1434,"sourceCodeEnd":1470,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/cli/src/commands/worktree.ts#L1434-L1470","documentation":"Thrown by readWorktreeSeedPendingMarker when the pending marker parses as JSON but fails the structural validation: it must be an object with version===1, state==='pending', and a non-empty string sourceConfigPath. Any deviation means the marker is from an incompatible version or hand-mangled.","triggerScenarios":"An older/newer marker format with a different version field; a complete marker accidentally renamed to the pending path; state field set to something other than 'pending'; sourceConfigPath missing, empty, or non-string.","commonSituations":"Version skew after upgrading the CLI that changed the marker schema; marker from a different tool written to the same path; manual edit removing a required field; pending marker overwritten by a complete marker due to a bug.","solutions":["Delete the invalid pending marker and re-run init/reseed so a conformant marker is written.","Upgrade or downgrade the CLI to a version whose marker schema matches the file.","If migrating formats, write a conversion shim or remove legacy markers before upgrading.","Avoid manually editing marker files."],"exampleFix":"# before: marker with state: 'old'\n# after\nrm .paperclip/seed-pending.json && paperclipai worktree init ...","handlingStrategy":"type-guard","validationCode":"function isValidPendingMarker(filePath: string): boolean {\n  try {\n    const p = JSON.parse(fs.readFileSync(filePath, 'utf8'));\n    return p && p.version === 1 && p.state === 'pending' && typeof p.sourceConfigPath === 'string' && p.sourceConfigPath.trim().length > 0;\n  } catch { return false; }\n}","typeGuard":"function isWorktreeSeedPendingMarker(v: unknown): v is WorktreeSeedPendingMarker {\n  return !!v && typeof v === 'object' && (v as any).version === 1 && (v as any).state === 'pending' && typeof (v as any).sourceConfigPath === 'string' && (v as any).sourceConfigPath.trim().length > 0;\n}","tryCatchPattern":"if (!isValidPendingMarker(markers.pending)) {\n  fs.rmSync(markers.pending, { force: true });\n  // re-trigger seed\n}","preventionTips":["Match CLI version with the marker schema.","Do not rename complete markers to pending.","Migrate or remove legacy markers on upgrade."],"tags":["worktree","seed","marker","schema","version-mismatch"],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}