paperclipai/paperclip · error · Error

Cannot seed worktree database because source config was not

Error message

Cannot seed worktree database because source config was not found at ${sourceConfigPath}. Use --no-seed or provide --from-config.

What it means

Thrown inside runWorktreeInit when opts.seed is not false (seeding is on, the default) but sourceConfig resolved to null. Unlike error 220 (which has a readable target and a bad source), here the source config file simply did not exist — existsSync(sourceConfigPath) was false at line 1640, so sourceConfig stayed null. The message directs the user to either disable seeding or supply an explicit source.

Source

Thrown at cli/src/commands/worktree.ts:1702

    nonEmpty(process.env.PAPERCLIP_AGENT_JWT_SECRET);
  mergePaperclipEnvEntries(
    {
      ...buildWorktreeEnvEntries(paths, branding),
      ...(existingAgentJwtSecret ? { PAPERCLIP_AGENT_JWT_SECRET: existingAgentJwtSecret } : {}),
    },
    paths.envPath,
  );
  ensureAgentJwtSecret(paths.configPath);
  loadPaperclipEnvFile(paths.configPath);
  const copiedGitHooks = copyGitHooksToWorktreeGitDir(cwd);

  let seedSummary: string | null = null;
  let seedExecutionQuarantineSummary: SeededWorktreeExecutionQuarantineSummary | null = null;
  let pausedScheduledRoutineCount: number | null = null;
  let reboundWorkspaceSummary: SeedWorktreeDatabaseResult["reboundWorkspaces"] = [];
  if (opts.seed !== false) {
    if (!sourceConfig) {
      throw new Error(
        `Cannot seed worktree database because source config was not found at ${sourceConfigPath}. Use --no-seed or provide --from-config.`,
      );
    }
    const spinner = p.spinner();
    spinner.start(`Seeding isolated worktree database from source instance (${seedMode})...`);
    try {
      const seeded = await seedWorktreeDatabase({
        sourceConfigPath,
        sourceConfig,
        targetConfig,
        targetPaths: paths,
        instanceId,
        seedMode,
        preserveLiveWork: opts.preserveLiveWork,
      });
      seedSummary = seeded.backupSummary;
      seedExecutionQuarantineSummary = seeded.executionQuarantine;
      pausedScheduledRoutineCount = seeded.pausedScheduledRoutines;

View on GitHub (pinned to 67001ec6eb)

Solutions

  1. Provide the source explicitly: `paperclipai worktree:init --from-config /abs/path/to/source/.paperclip/config.json`.
  2. Skip seeding if you want an empty worktree DB: `paperclipai worktree:init --no-seed`.
  3. If you expected a source config to exist, run `pnpm dev` once in the source repo to generate .paperclip/config.json, then retry init.
  4. Verify discovery by running the init from the source repo root.

Example fix

// before
paperclipai worktree:init   # no source config discoverable
// after
paperclipai worktree:init --from-config /home/me/paperclip/.paperclip/config.json
# or
paperclipai worktree:init --no-seed
Defensive patterns

Strategy: validation

Validate before calling

if (opts.seed !== false) {
  const sourceCfg = existsSync(sourceConfigPath) ? readConfig(sourceConfigPath) : null;
  if (!sourceCfg) {
    throw new Error(`No source config at ${sourceConfigPath}; pass --no-seed or --from-config.`);
  }
}

Type guard

function hasReadableSourceConfig(p: string): boolean {
  return existsSync(p) && readConfig(p) != null;
}

Try / catch

try { await runWorktreeInit(opts); }
catch (err) {
  if (/Cannot seed.*source config was not found/.test(String((err as Error).message))) {
    await runWorktreeInit({ ...opts, seed: false }); // empty DB fallback
  } else throw err;
}

Prevention

When it happens

Trigger: Running `worktree:init` outside any Paperclip repo (no discoverable source config) without --no-seed; the auto-discovered source .paperclip/config.json is absent; --from-config points at a path that does not exist.

Common situations: First-time setup in a fresh clone that has never run `pnpm dev` to generate a source config; running init from a subdirectory where source config discovery walks up and finds nothing; wrong --from-config path.

Related errors


AI-assisted analysis of paperclipai/paperclip@67001ec6eb (2026-08-12). Data as JSON: /api/errors/8613df8187699849. Report an issue: GitHub.