tinyhumansai/openhuman · error

[analytics] trackEvent failed

Error message

[analytics] trackEvent failed

What it means

Safety net around trackEventUnsafe inside trackEvent: the public event API wraps its provider fan-out (GA dataLayer push, OpenPanel send) so that a throw from any provider — unlisted event name path, serialization issue, or gtag absence — cannot propagate into feature code. The catch warns with the event name and error; the event is dropped, not queued.

Source

Thrown at app/src/services/analytics.ts:400

      ...properties,
    });
  }
  if (opInitialized) {
    void sendOpenPanelTrack('screen_view', { ...properties, __title: currentDocumentTitle() });
  }
}

/**
 * Send a privacy-limited feature-engagement event to all initialized providers.
 *
 * Event names must appear in `ALLOWED_EVENTS`. Calls with unlisted names
 * are dropped and a console warning is emitted.
 */
export function trackEvent(eventName: string, params?: AnalyticsParams): void {
  try {
    trackEventUnsafe(eventName, params);
  } catch (error) {
    console.warn('[analytics] trackEvent failed', {
      eventName,
      error: error instanceof Error ? error.name : typeof error,
    });
  }
}

/** Typed, best-effort facade for successful domain outcomes. */
export function trackAnalyticsEvent(eventName: AnalyticsEventName, params?: AnalyticsParams): void {
  trackEvent(eventName, params);
}

function trackEventUnsafe(eventName: string, params?: AnalyticsParams): void {
  if (!ALLOWED_EVENTS.has(eventName)) {
    console.warn(
      `[analytics] trackEvent dropped — '${eventName}' is not in ALLOWED_EVENTS allowlist`
    );
    return;
  }

View on GitHub (pinned to 7491200858)

Solutions

  1. Check the logged eventName against ALLOWED_EVENTS — unlisted names are the usual cause
  2. Fix the failing provider specifically (GA init vs OpenPanel) using the logged error
  3. Keep the wrapper: analytics must never break feature flows
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at app/src/services/analytics.ts:400 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of tinyhumansai/openhuman@7491200858 (2026-08-17). Data as JSON: /api/errors/0f341afd442e3c74. Report an issue: GitHub.