paperclipai/paperclip · error · Error
No company found by ID '${normalizedSelector}'.
Error message
No company found by ID '${normalizedSelector}'. What it means
Thrown when --by is 'id' and the GET /api/companies/{selector} lookup (with ignoreNotFound) returned null. Because the user explicitly asserted the selector is an ID, a miss is a hard failure rather than a fallback to prefix resolution. The normalized selector was treated as a UUID.
Source
Thrown at cli/src/commands/client/company.ts:1947
.action(async (selector: string, opts: CompanyDeleteOptions) => {
try {
const by = (opts.by ?? "auto").trim().toLowerCase() as CompanyDeleteSelectorMode;
if (!["auto", "id", "prefix"].includes(by)) {
throw new Error(`Invalid --by mode '${opts.by}'. Expected one of: auto, id, prefix.`);
}
const ctx = resolveCommandContext(opts);
const normalizedSelector = normalizeSelector(selector);
assertDeleteFlags(opts);
let target: Company | null = null;
const shouldTryIdLookup = by === "id" || (by === "auto" && isUuidLike(normalizedSelector));
if (shouldTryIdLookup) {
const byId = await ctx.api.get<Company>(apiPath`/api/companies/${normalizedSelector}`, { ignoreNotFound: true });
if (byId) {
target = byId;
} else if (by === "id") {
throw new Error(`No company found by ID '${normalizedSelector}'.`);
}
}
if (!target && ctx.companyId) {
const scoped = await ctx.api.get<Company>(apiPath`/api/companies/${ctx.companyId}`, { ignoreNotFound: true });
if (scoped) {
try {
target = resolveCompanyForDeletion([scoped], normalizedSelector, by);
} catch {
// Fallback to board-wide lookup below.
}
}
}
if (!target) {
try {
const companies = (await ctx.api.get<Company[]>("/api/companies")) ?? [];
target = resolveCompanyForDeletion(companies, normalizedSelector, by);View on GitHub (pinned to 67001ec6eb)
Solutions
- Verify the ID: `paperclipai company list --json` and copy the current id.
- Drop `--by id` to let auto/prefix resolution try the selector as a prefix.
- Ensure the auth token has access to the target company (board token for cross-company).
Example fix
# before paperclipai company delete 00000000-0000-0000-0000-000000000000 --by id --yes --confirm ... # after ID=$(paperclipai company list --json | jq -r '.[0].id') paperclipai company delete "$ID" --by id --yes --confirm "$PREFIX"
Defensive patterns
Strategy: validation
Validate before calling
// Confirm the company exists before asserting --by id in a delete.
async function companyExistsById(api: { get: (p: string, o?: { ignoreNotFound?: boolean }) => Promise<unknown> }, id: string): Promise<boolean> {
const c = await api.get(`/api/companies/${id}`, { ignoreNotFound: true });
return c != null;
} 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 {
const byId = await ctx.api.get<Company>(`/api/companies/${id}`, { ignoreNotFound: true });
if (!isCompany(byId)) throw new Error(`No company found by ID '${id}'`);
} catch (err) {
// Optionally fall back to --by prefix resolution here.
throw err;
} Prevention
- Resolve IDs dynamically via `company list --json` rather than hardcoding stale values.
- Prefer --by auto so the CLI falls back to prefix when an ID misses.
- Ensure the auth token can read the target company.
When it happens
Trigger: Running `paperclipai company delete <id> --by id ...` where <id> is not an existing company UUID; a typo in the UUID; the company was already deleted; the authenticated caller lacks read access to that company.
Common situations: Stale ID copied from an old list; company deleted in another session; agent-scoped API key trying to delete a company outside its scope (returns 404 via ignoreNotFound).
Related errors
- No company found for selector '${selector}'. Use company ID
- No company found for selector '${normalizedSelector}'.
- No company found by ID '${selector}'.
- No company found by shortname/prefix '${selector}'.
- Selector '${selector}' is ambiguous (matches both an ID and
AI-assisted analysis of paperclipai/paperclip@67001ec6eb (2026-08-12).
Data as JSON: /api/errors/4c06f2515698e977.
Report an issue: GitHub.