{"record":{"id":"e51fe52aa86328af","repo":"paperclipai/paperclip","slug":"current-company-is-not-available-pass-company-i","errorCode":null,"errorMessage":"Current company is not available. Pass --company-id, set PAPERCLIP_COMPANY_ID, set a context profile companyId, or authenticate with an agent API key.","messagePattern":"Current company is not available\\. Pass --company-id, set PAPERCLIP_COMPANY_ID, set a context profile companyId, or authenticate with an agent API key\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/client/company.ts","lineNumber":2041,"sourceCode":"    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.\",\n      );\n    }\n    throw error;\n  }\n\n  const fromAgent = agent?.companyId?.trim();\n  if (fromAgent) return fromAgent;\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.\",\n  );\n}\n\nfunction isBoardAccessRequiredError(error: unknown): error is ApiRequestError {\n  return error instanceof ApiRequestError && error.status === 403 && error.message.toLowerCase().includes(\"board access required\");\n}\n\nfunction isInstanceAdminRequiredError(error: unknown): error is ApiRequestError {","sourceCodeStart":2023,"sourceCodeEnd":2059,"githubUrl":"https://github.com/paperclipai/paperclip/blob/120ae5428fa29bee300bcf806491cd4d965fbb7c/cli/src/commands/client/company.ts#L2023-L2059","documentation":"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.","triggerScenarios":"Thrown at cli/src/commands/client/company.ts:2041 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass --company-id, set PAPERCLIP_COMPANY_ID, set a context profile companyId, or authenticate with an agent API key."],"exampleFix":null,"handlingStrategy":"validation","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"}