{"record":{"id":"11c63c6d0c6fd480","repo":"paperclipai/paperclip","slug":"managed-worktree-seed-registration-is-incomplete","errorCode":null,"errorMessage":"Managed worktree seed registration is incomplete; project workspace and company bindings are required.","messagePattern":"Managed worktree seed registration is incomplete; project workspace and company bindings are required\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/worktree.ts","lineNumber":2299,"sourceCode":"  const registeredBaseWorkspaceCwd = opts.registeredBaseWorkspaceCwd\n    ?? nonEmpty(process.env.PAPERCLIP_WORKSPACE_BASE_CWD)\n    ?? null;\n  if (!initialManifest && !legacyPending && !hasExplicitSource && !registeredBaseWorkspaceCwd) {\n    if (existsSync(markers.lock)) {\n      const releaseExistingLock = await acquireWorktreeSeedLock(markers.lock);\n      await releaseExistingLock();\n    }\n    return { seeded: false, reason: \"legacy_unmarked\" };\n  }\n  const registeredProjectWorkspaceId = opts.registeredProjectWorkspaceId\n    ?? nonEmpty(process.env.PAPERCLIP_PROJECT_WORKSPACE_ID)\n    ?? null;\n  const expectedCompanyId = opts.expectedCompanyId\n    ?? nonEmpty(process.env.PAPERCLIP_SEED_EXPECTED_COMPANY_ID)\n    ?? nonEmpty(process.env.PAPERCLIP_COMPANY_ID)\n    ?? undefined;\n  if (!explicitSourceConfigPath && registeredBaseWorkspaceCwd && (!registeredProjectWorkspaceId || !expectedCompanyId)) {\n    throw new Error(\n      \"Managed worktree seed registration is incomplete; project workspace and company bindings are required.\",\n    );\n  }\n\n  const targetRoot = path.dirname(path.dirname(configPath));\n  const targetPaths = resolveWorktreeReseedTargetPaths({ configPath, rootPath: targetRoot });\n  const registeredSeedSource = resolveRegisteredWorktreeSeedSource({\n    registeredBaseWorkspaceCwd,\n    explicitSourceConfigPath,\n    targetConfigPath: configPath,\n    expectedTargetInstanceId: targetPaths.instanceId,\n  });\n\n  if (initialManifest && initialManifest.targetInstanceId !== registeredSeedSource.targetInstanceId) {\n    throw new Error(\"Worktree seed manifest target instance does not match the registered target instance.\");\n  }\n\n  // Resolve all authority-bearing paths before creating the lock. The manifest is","sourceCodeStart":2281,"sourceCodeEnd":2317,"githubUrl":"https://github.com/paperclipai/paperclip/blob/a7e689b3c35347b529cb9f54c9b9a8575a3dcab6/cli/src/commands/worktree.ts#L2281-L2317","documentation":"For a managed (registered-base-workspace) reseed with no explicit source config, ensureWorktreeSeeded requires both a project workspace binding (opts.registeredProjectWorkspaceId or PAPERCLIP_PROJECT_WORKSPACE_ID) and a company binding (opts.expectedCompanyId, PAPERCLIP_SEED_EXPECTED_COMPANY_ID, or PAPERCLIP_COMPANY_ID). Without both, the seed cannot prove which workspace and company the clone belongs to, so it refuses rather than seed with ambiguous identity.","triggerScenarios":"Running worktree ensure-seeded from a worktree whose registered base workspace cwd is known, but the process env lacks PAPERCLIP_PROJECT_WORKSPACE_ID and the company vars, and no --source config path was passed — e.g. a service started with an incomplete environment, or a manual invocation outside the service wrapper.","commonSituations":"A worktree service whose env was hand-copied and dropped the registration vars; recreating a service unit without the registration block; moving a worktree registration to a new machine without its env.","solutions":["Set PAPERCLIP_PROJECT_WORKSPACE_ID and PAPERCLIP_COMPANY_ID (or PAPERCLIP_SEED_EXPECTED_COMPANY_ID) in the worktree service environment and retry","Or pass an explicit source config path so the seed does not depend on registration bindings","Or re-register / recreate the worktree so the registration stamps complete bindings"],"exampleFix":"# before (worktree service env)\nPAPERCLIP_CONFIG=/worktrees/foo/paperclip.config.json\n\n# after\nPAPERCLIP_CONFIG=/worktrees/foo/paperclip.config.json\nPAPERCLIP_PROJECT_WORKSPACE_ID=ws_123\nPAPERCLIP_COMPANY_ID=comp_456","handlingStrategy":"validation","validationCode":"const needWorkspace = process.env.PAPERCLIP_PROJECT_WORKSPACE_ID;\nconst needCompany = process.env.PAPERCLIP_SEED_EXPECTED_COMPANY_ID ?? process.env.PAPERCLIP_COMPANY_ID;\nif (registeredBaseWorkspaceCwd && !explicitSource && (!needWorkspace || !needCompany)) {\n  throw new Error('Seed registration bindings missing: set PAPERCLIP_PROJECT_WORKSPACE_ID and PAPERCLIP_COMPANY_ID.');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Stamp the full registration env (workspace id + company id) into every worktree service definition at creation time","Smoke-test worktree services with `ensure-seeded` right after registration"],"tags":["worktree","seed","environment","registration","env-var"],"backgroundTag":"missing-env-var","analyzedSha":"a7e689b3c35347b529cb9f54c9b9a8575a3dcab6","analyzedAt":"2026-08-21T17:58:32.592Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}