paperclipai/paperclip · error · Error

Company ID is required. Pass --company-id, set PAPERCLIP_COM

Error message

Company ID is required. Pass --company-id, set PAPERCLIP_COMPANY_ID, or configure a CLI context default.

What it means

resolveFeedbackCompanyId tries explicitCompanyId, then ctx.companyId, then the first company from GET /api/companies; if none yields an id it throws. Feedback-trace commands are company-scoped and need a resolved company.

Source

Thrown at cli/src/commands/client/feedback.ts:212

          const ctx = resolveCommandContext(opts);
          printOutput(await ctx.api.get(apiPath`/api/feedback-traces/${traceId}/bundle`), { json: ctx.json });
        } catch (err) {
          handleCommandError(err);
        }
      }),
  );
}

export async function resolveFeedbackCompanyId(
  ctx: ResolvedClientContext,
  explicitCompanyId?: string,
): Promise<string> {
  const direct = explicitCompanyId?.trim() || ctx.companyId?.trim();
  if (direct) return direct;
  const companies = (await ctx.api.get<Company[]>("/api/companies")) ?? [];
  const companyId = companies[0]?.id?.trim();
  if (!companyId) {
    throw new Error(
      "Company ID is required. Pass --company-id, set PAPERCLIP_COMPANY_ID, or configure a CLI context default.",
    );
  }
  return companyId;
}

export function buildFeedbackTraceQuery(opts: FeedbackTraceQueryOptions, includePayload = true): string {
  const params = new URLSearchParams();
  if (opts.targetType) params.set("targetType", opts.targetType);
  if (opts.vote) params.set("vote", opts.vote);
  if (opts.status) params.set("status", opts.status);
  if (opts.projectId) params.set("projectId", opts.projectId);
  if (opts.issueId) params.set("issueId", opts.issueId);
  if (opts.from) params.set("from", opts.from);
  if (opts.to) params.set("to", opts.to);
  if (opts.sharedOnly) params.set("sharedOnly", "true");
  if (includePayload) params.set("includePayload", "true");
  const query = params.toString();

View on GitHub (pinned to 67001ec6eb)

Solutions

  1. Set PAPERCLIP_COMPANY_ID in your shell.
  2. Run `paperclipai context set --company-id <id>` for the active profile.
  3. Pass --company-id on the feedback command.
  4. Ensure at least one company exists for the board credential.
Defensive patterns

Strategy: validation

Validate before calling

function resolveCompanyId(explicit?: string, ctxCompanyId?: string, companies: Company[] = []) {
  const direct = (explicit ?? '').trim() || (ctxCompanyId ?? '').trim();
  if (direct) return direct;
  const first = companies[0]?.id?.trim();
  if (!first) throw new Error('Company ID is required.');
  return first;
}

Prevention

When it happens

Trigger: Running a feedback command with no --company-id, no PAPERCLIP_COMPANY_ID, no profile companyId, and an empty /api/companies result.

Common situations: New CLI profile never configured; env var unset in the shell; board credential with no companies.

Related errors


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