paperclipai/paperclip · error · Error

Seed validation found an incomplete auth, membership, compan

Error message

Seed validation found an incomplete auth, membership, company, or issue shape.

What it means

A belt-and-braces count check after the row-level admin and representative probes: the validation summary must show at least one auth user, one instance admin, one active membership, one company, one issue — and one credential account when the mode requires it. It catches partially-populated databases that slip past the point checks because the queries used different filters.

Source

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

      authUserCount: counts?.authUserCount ?? 0,
      credentialAccountCount: counts?.credentialAccountCount ?? 0,
      instanceAdminCount: counts?.instanceAdminCount ?? 0,
      activeMembershipCount: counts?.activeMembershipCount ?? 0,
      companyCount: counts?.companyCount ?? 0,
      issueCount: counts?.issueCount ?? 0,
      representativeCompanyId: representative.companyId,
      representativeIssueId: representative.issueId,
      migrationRevision,
    };
    if (
      summary.authUserCount < 1
      || (requiresCredentialAccount && summary.credentialAccountCount < 1)
      || summary.instanceAdminCount < 1
      || summary.activeMembershipCount < 1
      || summary.companyCount < 1
      || summary.issueCount < 1
    ) {
      throw new Error("Seed validation found an incomplete auth, membership, company, or issue shape.");
    }

    return {
      summary,
      expectation: {
        adminUserId: admin.userId,
        representativeCompanyId: representative.companyId,
        representativeIssueId: representative.issueId,
      },
    };
  } finally {
    await db.$client?.end?.({ timeout: 5 }).catch(() => undefined);
  }
}

async function seedWorktreeDatabase(input: {
  sourceConfigPath: string;
  sourceConfig: PaperclipConfig;

View on GitHub (pinned to a7e689b3c3)

Solutions

  1. Re-snapshot or re-clone from a healthy source database and reseed the target
  2. Verify the source DB passes all counts itself before using it as a seed origin
  3. If a specific table is empty on the source, fix the source data (onboard/create records) and retry
Defensive patterns

Strategy: validation

Validate before calling

const counts = await countSeedShape(/* source connection */);
const ok = counts.authUserCount >= 1 && counts.instanceAdminCount >= 1
  && counts.activeMembershipCount >= 1 && counts.companyCount >= 1 && counts.issueCount >= 1
  && (!requiresCredentialAccount || counts.credentialAccountCount >= 1);
if (!ok) throw new Error('Source DB is not a viable seed origin; fix or re-snapshot it.');

Try / catch

Catch and fall back to re-snapshotting from a known-healthy source instead of seeding from the partial database.

Prevention

When it happens

Trigger: Any of the summary counts (authUserCount, credentialAccountCount when requiresCredentialAccount, instanceAdminCount, activeMembershipCount, companyCount, issueCount) is zero — typically a partial clone/restore where one table lost all rows while others kept theirs.

Common situations: A snapshot restored with one table missing; pg_restore interrupted; a hand-built source database with users but no memberships; concurrent truncation between the count query and the row queries.

Related errors


AI-assisted analysis of paperclipai/paperclip@a7e689b3c3 (2026-08-21). Data as JSON: /api/errors/25078d226e82bc29. Report an issue: GitHub.