paperclipai/paperclip · error · Error

Company selector is required.

Error message

Company selector is required.

What it means

Thrown by resolveCompanyForDeletion when the company selector argument is empty after normalizeSelector trims it. Deletion requires an explicit identifier (id or issue prefix); an empty selector would otherwise match nothing or, worse, be ambiguous.

Source

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

  });

  if (p.isCancel(confirmed) || !confirmed) {
    throw new Error("Export cancelled.");
  }
}

function matchesPrefix(company: Company, selector: string): boolean {
  return company.issuePrefix.toUpperCase() === selector.toUpperCase();
}

export function resolveCompanyForDeletion(
  companies: Company[],
  selectorRaw: string,
  by: CompanyDeleteSelectorMode = "auto",
): Company {
  const selector = normalizeSelector(selectorRaw);
  if (!selector) {
    throw new Error("Company selector is required.");
  }

  const idMatch = companies.find((company) => company.id === selector);
  const prefixMatch = companies.find((company) => matchesPrefix(company, selector));

  if (by === "id") {
    if (!idMatch) {
      throw new Error(`No company found by ID '${selector}'.`);
    }
    return idMatch;
  }

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

View on GitHub (pinned to 67001ec6eb)

Solutions

  1. Pass the company id or issue prefix: 'paperclipai company delete <id-or-prefix>'.
  2. Run 'paperclipai company list' to find the id or prefix, then pass it.
  3. In scripts, validate that the selector variable is non-empty before invoking delete.

Example fix

# before
paperclipai company delete --yes --confirm PAP
# after
paperclipai company delete PAP --yes --confirm PAP
Defensive patterns

Strategy: validation

Validate before calling

function requireCompanySelector(selectorRaw: string): string {
  const s = selectorRaw.trim();
  if (!s) throw new Error("Company selector is required (id or issue prefix).");
  return s;
}

Type guard

function hasCompanySelector(selectorRaw: string): boolean {
  return selectorRaw.trim().length > 0;
}

Prevention

When it happens

Trigger: Running 'paperclipai company delete' with no selector argument, an empty string, or only whitespace. A script that threads an unset environment variable as the selector.

Common situations: User forgets the positional selector. A wrapper script that interpolates an empty $COMPANY env var. Copy-pasting a command template without filling in the placeholder.

Related errors


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