CopilotKit/CopilotKit · error

Failed to stringify inspector payload

Error message

Failed to stringify inspector payload

What it means

Error "Failed to stringify inspector payload" thrown in CopilotKit/CopilotKit.

Source

Thrown at packages/web-inspector/src/index.ts:8206

    if (type.startsWith("STATE") || type.startsWith("MESSAGES")) {
      return `${base} bg-violet-50 text-gray-900 border-violet-200`;
    }

    return `${base} bg-gray-100 text-gray-900 border-gray-200`;
  }

  private stringifyPayload(payload: unknown, pretty: boolean): string {
    try {
      if (payload === undefined) {
        return pretty ? "undefined" : "undefined";
      }
      if (typeof payload === "string") {
        return payload;
      }
      return JSON.stringify(payload, null, pretty ? 2 : 0) ?? "";
    } catch (error) {
      console.warn("Failed to stringify inspector payload", error);
      return String(payload);
    }
  }

  private extractEventFromPayload(payload: unknown): unknown {
    // If payload is an object with an 'event' field, extract it
    if (payload && typeof payload === "object" && "event" in payload) {
      return (payload as Record<string, unknown>).event;
    }
    // Otherwise, assume the payload itself is the event
    return payload;
  }

  /** Prefer the window that owns the UI: the popup while popped out. */
  private getClipboard(event?: Event): Clipboard | undefined {
    if (this.isPoppedOut) {
      const popped = this.popOut?.win.navigator.clipboard;
      if (popped) {

View on GitHub (pinned to 68fbe97d87)

When it happens

Trigger: Thrown at packages/web-inspector/src/index.ts:8206 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of CopilotKit/CopilotKit@68fbe97d87 (2026-08-27). Data as JSON: /api/errors/666440795701970c. Report an issue: GitHub.