{"record":{"id":"c3706310070b00a4","repo":"paperclipai/paperclip","slug":"invalid-worktree-seed-pending-marker-at-filepath","errorCode":null,"errorMessage":"Invalid worktree seed-pending marker at ${filePath}: ${error instanceof Error ? error.message : String(error)}","messagePattern":"Invalid worktree seed-pending marker at (.+?): (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/worktree.ts","lineNumber":1439,"sourceCode":"  seedMode?: WorktreeSeedMode;\n  now?: Date;\n}): void {\n  const markers = resolveWorktreeSeedMarkerPaths(input.configPath);\n  writeWorktreeSeedMarker(markers.complete, {\n    version: 1,\n    state: \"complete\",\n    seedMode: input.seedMode ?? \"minimal\",\n    completedAt: (input.now ?? new Date()).toISOString(),\n  });\n  rmSync(markers.pending, { force: true });\n}\n\nfunction 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","sourceCodeStart":1421,"sourceCodeEnd":1457,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/cli/src/commands/worktree.ts#L1421-L1457","documentation":"Thrown by readWorktreeSeedPendingMarker when the pending marker file cannot be JSON.parse'd or read. This indicates the marker file is corrupt, truncated, or not valid JSON. The raw parse error message is appended for diagnosis.","triggerScenarios":"The pending marker file was written partially (crash during writeWorktreeSeedMarker); another process wrote a non-JSON file at the marker path; disk corruption or manual editing broke the JSON; the file is empty.","commonSituations":"Previous seed process killed mid-write; concurrent writers racing on the marker path; filesystem full at write time truncating the file; user manually editing the marker.","solutions":["Inspect the marker file content to confirm it is invalid JSON.","If no seed is running, delete the corrupt pending marker and re-trigger the seed (it will be regenerated).","Ensure only one seed process writes the marker at a time (the seed lock guards this).","Restore from backup if the marker contained needed sourceConfigPath info before deleting."],"exampleFix":"# before: corrupt marker\n# after\nrm .paperclip/seed-pending.json && paperclipai worktree reseed ...","handlingStrategy":"validation","validationCode":"function markerParses(filePath: string): boolean {\n  try { JSON.parse(fs.readFileSync(filePath, 'utf8')); return true; } catch { return false; }\n}","typeGuard":null,"tryCatchPattern":"try {\n  readWorktreeSeedPendingMarker(markers.pending);\n} catch (e) {\n  if (/Invalid worktree seed-pending marker/.test((e as Error).message)) {\n    if (noSeedRunning) fs.rmSync(markers.pending, { force: true });\n  }\n}","preventionTips":["Avoid killing seed processes mid-write.","Do not hand-edit marker files.","Validate the marker before relying on it."],"tags":["worktree","seed","marker","json","corruption"],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}