paperclipai/paperclip · error · Error

Company '${company.name}' has no agents to connect.

Error message

Company '${company.name}' has no agents to connect.

What it means

Thrown when the chosen company exists but has no agents to bind a profile to. The flow calls GET /api/companies/{company.id}/agents and aborts when the resulting array is empty.

Source

Thrown at cli/src/commands/client/connect.ts:128

    setCurrentProfile(profileName, opts.context);
    p.outro(pc.green(`Connected profile '${profileName}' as board.`));
    return {
      ok: true,
      profile: profileName,
      persona: "board",
      apiBase,
      companyId: company?.id ?? null,
      key: publicKeyResult(key),
      exports: buildExports({ apiBase, companyId: company?.id, agentId: undefined, envName: apiKeyEnvVarName, token: key.token }),
    };
  }

  const company = await chooseCompany(companies, opts.companyId ?? resolvedProfile.profile.companyId, {
    optional: false,
  });
  if (!company) throw new Error("Company is required for agent profiles");
  const agents = (await boardApi.get<Agent[]>(apiPath`/api/companies/${company.id}/agents`)) ?? [];
  if (agents.length === 0) throw new Error(`Company '${company.name}' has no agents to connect.`);
  const agent = await chooseAgent(agents, resolvedProfile.profile.agentId);
  const tokenName = opts.tokenName?.trim() || `cli-agent-${new Date().toISOString()}`;
  const key = await boardApi.post<CreatedAgentKey>(apiPath`/api/agents/${agent.id}/keys`, createAgentKeySchema.parse({ name: tokenName }));
  if (!key) throw new Error("Failed to create agent token");
  upsertProfile(profileName, {
    apiBase,
    companyId: company.id,
    persona: "agent",
    agentId: agent.id,
    agentName: agent.name,
    apiKeyEnvVarName,
    tokenName: key.name,
    tokenId: key.id,
    tokenCreatedAt: key.createdAt,
  }, opts.context);
  setCurrentProfile(profileName, opts.context);
  p.outro(pc.green(`Connected profile '${profileName}' as ${agent.name}.`));
  return {

View on GitHub (pinned to 67001ec6eb)

Solutions

  1. Create at least one agent in the company (board UI or POST /api/companies/{id}/agents) and re-run connect.
  2. Confirm you connected against the intended company; switch profile or pass --company-id.
  3. Re-run connect and explicitly choose a company that has agents.
Defensive patterns

Strategy: validation

Validate before calling

const agents = (await boardApi.get(`/api/companies/${companyId}/agents`)) ?? [];
if (agents.length === 0) {
  throw new Error(`Create an agent in company ${companyId} before connecting.`);
}

Prevention

When it happens

Trigger: Running `paperclipai connect` for an agent profile against a company whose GET /api/companies/{companyId}/agents returns [].

Common situations: Freshly created company with no agents yet; all agents deleted; wrong company auto-selected because only one exists.

Related errors


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