{"record":{"id":"4054e1c9b44db286","repo":"paperclipai/paperclip","slug":"creating-companies-requires-board-instance-admin-a","errorCode":null,"errorMessage":"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.","messagePattern":"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\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/client/company.ts","lineNumber":2024,"sourceCode":"  } catch (error) {\n    if (!isBoardAccessRequiredError(error)) {\n      throw error;\n    }\n  }\n\n  const companyId = await resolveCurrentCompanyId(ctx);\n  const scopedCompany = await ctx.api.get<Company>(apiPath`/api/companies/${companyId}`);\n  return scopedCompany ? [scopedCompany] : [];\n}\n\nasync function createCompanyForContext(ctx: {\n  api: { post<T>(path: string, body?: unknown): Promise<T | null> };\n}, payload: unknown): Promise<unknown> {\n  try {\n    return await ctx.api.post(\"/api/companies\", payload);\n  } catch (error) {\n    if (isBoardAccessRequiredError(error) || isInstanceAdminRequiredError(error)) {\n      throw new Error(\n        \"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.\",\n      );\n    }\n    throw error;\n  }\n}\n\nasync function resolveCurrentCompanyId(ctx: { companyId?: string; api: { get<T>(path: string): Promise<T | null> } }): Promise<string> {\n  const fromContext = ctx.companyId?.trim();\n  if (fromContext) return fromContext;\n\n  let agent: AgentMeResponse | null = null;\n  try {\n    agent = await ctx.api.get<AgentMeResponse>(\"/api/agents/me\");\n  } catch (error) {\n    if (error instanceof ApiRequestError && (error.status === 401 || error.status === 403)) {\n      throw new Error(\n        \"Current company is not available. Pass --company-id, set PAPERCLIP_COMPANY_ID, set a context profile companyId, or authenticate with an agent API key.\",","sourceCodeStart":2006,"sourceCodeEnd":2042,"githubUrl":"https://github.com/paperclipai/paperclip/blob/120ae5428fa29bee300bcf806491cd4d965fbb7c/cli/src/commands/client/company.ts#L2006-L2042","documentation":"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.\" thrown in paperclipai/paperclip.","triggerScenarios":"Thrown at cli/src/commands/client/company.ts:2024 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Re-run with a board token/login, or use `paperclipai company list --json` / `company current --json` to work with the agent-scoped company."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"120ae5428fa29bee300bcf806491cd4d965fbb7c","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}