paperclipai/paperclip · error · Error

No company found for selector '${selector}'. Use company ID

Error message

No company found for selector '${selector}'. Use company ID or issue prefix (for example PAP).

What it means

Thrown by resolveCompanyForDeletion in auto mode when the selector matches neither any company id nor any issue prefix. This is the catch-all 'no match' fallback after id and prefix lookups both return empty and there is no ambiguity.

Source

Thrown at cli/src/commands/client/company.ts:1308

  }

  if (by === "prefix") {
    if (!prefixMatch) {
      throw new Error(`No company found by shortname/prefix '${selector}'.`);
    }
    return prefixMatch;
  }

  if (idMatch && prefixMatch && idMatch.id !== prefixMatch.id) {
    throw new Error(
      `Selector '${selector}' is ambiguous (matches both an ID and a shortname). Re-run with --by id or --by prefix.`,
    );
  }

  if (idMatch) return idMatch;
  if (prefixMatch) return prefixMatch;

  throw new Error(
    `No company found for selector '${selector}'. Use company ID or issue prefix (for example PAP).`,
  );
}

export function assertDeleteConfirmation(company: Company, opts: CompanyDeleteOptions): void {
  if (!opts.yes) {
    throw new Error("Deletion requires --yes.");
  }

  const confirm = opts.confirm?.trim();
  if (!confirm) {
    throw new Error(
      "Deletion requires --confirm <value> where value matches the company ID or issue prefix.",
    );
  }

  const confirmsById = confirm === company.id;
  const confirmsByPrefix = confirm.toUpperCase() === company.issuePrefix.toUpperCase();

View on GitHub (pinned to 67001ec6eb)

Solutions

  1. Run 'paperclipai company list' to see current ids and prefixes.
  2. Confirm you are pointed at the right API base / tenant for the company you expect.
  3. Copy the id or prefix verbatim from the list output and re-run.
  4. If the company was deleted, choose a different target or restore it first.

Example fix

# before
paperclipai company delete xyz --yes --confirm xyz
# after
paperclipai company list   # confirm valid selector
paperclipai company delete cmp_real --yes --confirm cmp_real
Defensive patterns

Strategy: validation

Validate before calling

function ensureCompanySelectable(companies: { id: string; issuePrefix: string }[], selector: string): void {
  const hit = companies.find(
    (c) => c.id === selector || c.issuePrefix.toUpperCase() === selector.toUpperCase(),
  );
  if (!hit) throw new Error(`No company matches '${selector}'. Verify id/prefix or tenant.`);
}

Type guard

function companySelectorMatches(companies: { id: string; issuePrefix: string }[], selector: string): boolean {
  return companies.some(
    (c) => c.id === selector || c.issuePrefix.toUpperCase() === selector.toUpperCase(),
  );
}

Prevention

When it happens

Trigger: Passing a selector that is neither an existing id nor an existing prefix. A selector for a company that has been deleted. A selector from the wrong tenant/list. Pure typo.

Common situations: Stale id copied from an old note. Company deleted by another operator. Wrong API base/tenant. Selector includes stray characters or whitespace inside (not at the ends).

Related errors


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