{"record":{"id":"645c9f247f7f958e","repo":"paperclipai/paperclip","slug":"failed-to-create-a-pending-worktree-seed-manifest","errorCode":null,"errorMessage":"Failed to create a pending worktree seed manifest.","messagePattern":"Failed to create a pending worktree seed manifest\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/worktree.ts","lineNumber":2379,"sourceCode":"          status: \"succeeded\",\n          state: \"verified\",\n          snapshotAt: new Date().toISOString(),\n          migrationRevision: legacyEvidence.migrationRevision,\n          message: \"Adopted an existing legacy worktree database after validating its migration journal and core schema.\",\n        });\n        return { seeded: false, reason: \"legacy_database\" };\n      }\n\n      markWorktreeSeedPending({\n        configPath,\n        sourceConfigPath: registeredSeedSource.configPath,\n        targetInstanceId: targetPaths.instanceId,\n        seedMode: \"minimal\",\n        diagnosticMessage: \"No verified seed or compatible legacy database was found; provisioning is required.\",\n      });\n      manifest = readWorktreeSeedManifest(configPath);\n      if (!manifest) {\n        throw new Error(\"Failed to create a pending worktree seed manifest.\");\n      }\n    }\n    if (\n      manifest.source.configPath !== registeredSeedSource.configPath\n      || manifest.source.instanceId !== registeredSeedSource.instanceId\n    ) {\n      markWorktreeSeedPending({\n        configPath,\n        sourceConfigPath: registeredSeedSource.configPath,\n        targetInstanceId: manifest.targetInstanceId,\n        seedMode: manifest.seedMode,\n        diagnosticMessage: \"Re-derived seed source diagnostics from the registered canonical source.\",\n      });\n      manifest = readWorktreeSeedManifest(configPath)!;\n    }\n    canonicalSource = resolveCanonicalWorktreeSeedSource({\n      registeredBaseWorkspaceCwd,\n      explicitSourceConfigPath,","sourceCodeStart":2361,"sourceCodeEnd":2397,"githubUrl":"https://github.com/paperclipai/paperclip/blob/a7e689b3c35347b529cb9f54c9b9a8575a3dcab6/cli/src/commands/worktree.ts#L2361-L2397","documentation":"When no verified seed and no compatible legacy database exists, ensureWorktreeSeeded calls markWorktreeSeedPending to write a fresh pending manifest and immediately re-reads it. If the re-read still returns null, the manifest that was just written is already gone — the write itself is atomic, so the disappearance is a concurrent deletion (or a marker directory that silently loses writes, e.g. broken storage).","triggerScenarios":"A cleanup or competing process deletes the marker file between markWorktreeSeedPending's write and the re-read; the markers directory is on a filesystem/mount where writes do not persist; heavy marker churn from racing seeds.","commonSituations":"Worktree cleanup racing first-time provisioning; a watchdog script that wipes marker files; read-only or flaky overlay mounts for the worktree config dir.","solutions":["Stop any concurrent cleanup/reset processes touching the worktree markers and retry ensureWorktreeSeeded","Verify the markers directory is writable and persists (ls the manifest path right after a run)","If storage is flaky, move the worktree config/marker dir to reliable local storage"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"markWorktreeSeedPending({ configPath, sourceConfigPath, targetInstanceId, seedMode: 'minimal' });\nif (!existsSync(resolveWorktreeSeedMarkerPaths(configPath).manifest)) {\n  throw new Error('Marker directory is losing writes; check for concurrent cleanup or broken storage.');\n}","typeGuard":null,"tryCatchPattern":"Catch, confirm no cleanup process is deleting markers, then retry ensureWorktreeSeeded once; a repeat failure indicates filesystem trouble, not a seed bug.","preventionTips":["Never run marker-wiping 'reset' scripts while seeds are in flight","Keep worktree config/marker dirs on reliable local storage"],"tags":["worktree","seed","manifest","concurrency","filesystem"],"backgroundTag":"missing-state-file","analyzedSha":"a7e689b3c35347b529cb9f54c9b9a8575a3dcab6","analyzedAt":"2026-08-21T17:58:32.592Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}