paperclipai/paperclip · error

agentId is required because PAPERCLIP_AGENT_ID is not set

Error message

agentId is required because PAPERCLIP_AGENT_ID is not set

What it means

Error "agentId is required because PAPERCLIP_AGENT_ID is not set" thrown in paperclipai/paperclip.

Solutions

  1. Set PAPERCLIP_AGENT_ID or pass agentId explicitly to the tool call.

When it happens

Trigger: Thrown at packages/mcp-server/src/client.ts:73 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at packages/mcp-server/src/client.ts:73

    return {
      companyId: this.config.companyId,
      agentId: this.config.agentId,
      runId: this.config.runId,
    };
  }

  resolveCompanyId(companyId?: string | null): string {
    const resolved = companyId?.trim() || this.config.companyId;
    if (!resolved) {
      throw new Error("companyId is required because PAPERCLIP_COMPANY_ID is not set");
    }
    return resolved;
  }

  resolveAgentId(agentId?: string | null): string {
    const resolved = agentId?.trim() || this.config.agentId;
    if (!resolved) {
      throw new Error("agentId is required because PAPERCLIP_AGENT_ID is not set");
    }
    return resolved;
  }

  async requestJson<T>(method: string, path: string, options: JsonRequestOptions = {}): Promise<T> {
    if (!path.startsWith("/")) {
      throw new Error(`API path must start with "/": ${path}`);
    }

    const url = new URL(path.slice(1), `${this.config.apiUrl}/`);
    const headers: Record<string, string> = {
      Authorization: `Bearer ${this.config.apiKey}`,
      Accept: "application/json",
    };
    if (options.body !== undefined) {
      headers["Content-Type"] = "application/json";
    }
    if ((options.includeRunId ?? isWriteMethod(method)) && this.config.runId) {

View on GitHub (pinned to 120ae5428f)