paperclipai/paperclip · error · Error

No representative cloned company and issue pair is readable.

Error message

No representative cloned company and issue pair is readable.

What it means

After the admin check, seed validation selects one representative row from companies INNER JOIN issues (with optional expected representative ids and required company filters). The inner join means a company with zero issues produces no row. This pair is the proof that cloned business data is readable, and its ids are recorded in the seed expectation.

Source

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

          : "No auth user has an instance-admin role and active company membership for local-trusted worktree seeding.",
      );
    }

    const representative = await db
      .select({ companyId: companies.id, issueId: issues.id })
      .from(companies)
      .innerJoin(issues, eq(issues.companyId, companies.id))
      .where(
        and(
          expected ? eq(companies.id, expected.representativeCompanyId) : undefined,
          expected ? eq(issues.id, expected.representativeIssueId) : undefined,
          requiredCompanyId ? eq(companies.id, requiredCompanyId) : undefined,
        ),
      )
      .limit(1)
      .then((rows) => rows[0] ?? null);
    if (!representative) {
      throw new Error("No representative cloned company and issue pair is readable.");
    }

    const summary: WorktreeSeedValidationSummary = {
      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

View on GitHub (pinned to a7e689b3c3)

Solutions

  1. Create at least one issue in the source company so a company-issue pair exists, then retry
  2. If the expectation is stale (deleted issue/company), clear the seed expectation or markers so it is re-derived
  3. Check requiredCompanyId / expected ids passed via options or env actually match live rows
Defensive patterns

Strategy: validation

Validate before calling

-- pre-check: a representative pair must exist
SELECT c.id AS company_id, i.id AS issue_id
FROM companies c
JOIN issues i ON i.company_id = c.id
LIMIT 1; -- zero rows = seed will fail

Try / catch

Catch and report 'source has no company with an issue; create one issue before seeding' rather than retrying blindly.

Prevention

When it happens

Trigger: The representative query runs when the source DB has no company that owns at least one issue, or when expected.representativeCompanyId / representativeIssueId / requiredCompanyId filters exclude every existing pair (e.g. the recorded issue was deleted since the expectation was written).

Common situations: A freshly onboarded instance with a company but no issues yet; issues deleted after the seed expectation was recorded; wrong PAPERCLIP_SEED_EXPECTED_COMPANY_ID pinning a company that has no issues.

Related errors


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