paperclipai/paperclip · error · Error

No company found for selector '${normalizedSelector}'.

Error message

No company found for selector '${normalizedSelector}'.

What it means

Thrown after all resolution strategies (by-id lookup, scoped-company match, board-wide listing) failed to assign a target company. The selector matched nothing under the active --by mode and credentials. This is the catch-all 'not found' for the delete selector.

Source

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

            }
          }

          if (!target) {
            try {
              const companies = (await ctx.api.get<Company[]>("/api/companies")) ?? [];
              target = resolveCompanyForDeletion(companies, normalizedSelector, by);
            } catch (error) {
              if (error instanceof ApiRequestError && error.status === 403 && error.message.includes("Board access required")) {
                throw new Error(
                  "Board access is required to resolve companies across the instance. Use a company ID/prefix for your current company, or run with board authentication.",
                );
              }
              throw error;
            }
          }

          if (!target) {
            throw new Error(`No company found for selector '${normalizedSelector}'.`);
          }

          assertDeleteConfirmation(target, opts);

          await ctx.api.delete<{ ok: true }>(apiPath`/api/companies/${target.id}`);

          printOutput(
            {
              ok: true,
              deletedCompanyId: target.id,
              deletedCompanyName: target.name,
              deletedCompanyPrefix: target.issuePrefix,
            },
            { json: ctx.json },
          );
        } catch (err) {
          handleCommandError(err);
        }

View on GitHub (pinned to 67001ec6eb)

Solutions

  1. List available companies to confirm the selector: `paperclipai company list --json` (board token) or `paperclipai company current --json` (agent token).
  2. Check the api-base is correct: `paperclipai context current`.
  3. Retry with the exact id via `--by id` once confirmed.
  4. If using a prefix, ensure it matches the company's issuePrefix exactly (case-insensitive).
Defensive patterns

Strategy: validation

Validate before calling

// Resolve the company before delete so the selector is guaranteed to match.
async function resolveTargetForDelete(api: { get: (p: string, o?: { ignoreNotFound?: boolean }) => Promise<unknown> }, selector: string): Promise<string> {
  const byId = await api.get(`/api/companies/${selector}`, { ignoreNotFound: true });
  if (byId) return selector;
  const all = (await api.get<unknown[]>("/api/companies")) as Array<{ id: string; issuePrefix: string }>;
  const match = all.find(c => c.issuePrefix.toUpperCase() === selector.toUpperCase());
  if (!match) throw new Error(`No company matches selector '${selector}'`);
  return match.id;
}

Type guard

import type { Company } from "@paperclipai/shared";

function isCompany(v: unknown): v is Company {
  return !!v && typeof v === "object" && typeof (v as Company).id === "string";
}

Try / catch

try {
  target = resolveCompanyForDeletion(companies, selector, by);
} catch {
  throw new Error(`No company found for selector '${selector}'; verify with 'company list'.`);
}

Prevention

When it happens

Trigger: Selector is a prefix/ID that does not exist on the instance; selector has trailing characters or wrong casing for prefix (note: prefix match is case-insensitive in resolveCompanyForDeletion); the caller has access only to companies that do not match; --by auto tried both id and prefix and both missed.

Common situations: Typo in the selector; company renamed/its prefix changed; wrong instance (api-base points at staging but the company lives in prod); agent key scoped to a different company.

Related errors


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