paperclipai/paperclip · error · Error

Current company is not available. Pass --company-id, set…

Error message

Current company is not available. Pass --company-id, set PAPERCLIP_COMPANY_ID, set a context profile companyId, or authenticate with an agent API key.

What it means

resolveCurrentCompanyId found no company identifier from --company-id, PAPERCLIP_COMPANY_ID, the context profile, or an agent-key scoped /agents/me lookup, so company-scoped commands cannot proceed.

Solutions

  1. Pass --company-id, set PAPERCLIP_COMPANY_ID, set a context profile companyId, or authenticate with an agent API key.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at cli/src/commands/client/company.ts:2041 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of paperclipai/paperclip@120ae5428f (2026-08-18). Data as JSON: /api/errors/e51fe52aa86328af. Report an issue: GitHub.

Appendix: source

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

    if (isBoardAccessRequiredError(error) || isInstanceAdminRequiredError(error)) {
      throw new Error(
        "Creating companies requires board/instance-admin authentication. Agent API keys are scoped to one company; use `paperclipai company list --json` or `paperclipai company current --json` to select the scoped company, or rerun create with a board token/login.",
      );
    }
    throw error;
  }
}

async function resolveCurrentCompanyId(ctx: { companyId?: string; api: { get<T>(path: string): Promise<T | null> } }): Promise<string> {
  const fromContext = ctx.companyId?.trim();
  if (fromContext) return fromContext;

  let agent: AgentMeResponse | null = null;
  try {
    agent = await ctx.api.get<AgentMeResponse>("/api/agents/me");
  } catch (error) {
    if (error instanceof ApiRequestError && (error.status === 401 || error.status === 403)) {
      throw new Error(
        "Current company is not available. Pass --company-id, set PAPERCLIP_COMPANY_ID, set a context profile companyId, or authenticate with an agent API key.",
      );
    }
    throw error;
  }

  const fromAgent = agent?.companyId?.trim();
  if (fromAgent) return fromAgent;
  throw new Error(
    "Current company is not available. Pass --company-id, set PAPERCLIP_COMPANY_ID, set a context profile companyId, or authenticate with an agent API key.",
  );
}

function isBoardAccessRequiredError(error: unknown): error is ApiRequestError {
  return error instanceof ApiRequestError && error.status === 403 && error.message.toLowerCase().includes("board access required");
}

function isInstanceAdminRequiredError(error: unknown): error is ApiRequestError {

View on GitHub (pinned to 120ae5428f)