medusajs/medusa · error · MedusaError

Error identifying event for ${ "group" in data ? d

Error message

Error identifying event for ${
          "group" in data ? data.group.id : data.actor_id
        }: ${error.message}

What it means

Thrown by the analytics module's identify() when the configured analytics provider's identify() call fails; wraps the provider error message with the group id or actor id that was being identified. Like track(), this is UNEXPECTED_STATE and points at the provider, not the module.

Source

Thrown at packages/modules/analytics/src/services/analytics-service.ts:44

    return this.analyticsProviderService_
  }

  async track(data: TrackAnalyticsEventDTO): Promise<void> {
    try {
      await this.analyticsProviderService_.track(data)
    } catch (error) {
      throw new MedusaError(
        MedusaError.Types.UNEXPECTED_STATE,
        `Error tracking event for ${data.event}: ${error.message}`
      )
    }
  }

  async identify(data: IdentifyAnalyticsEventDTO): Promise<void> {
    try {
      await this.analyticsProviderService_.identify(data)
    } catch (error) {
      throw new MedusaError(
        MedusaError.Types.UNEXPECTED_STATE,
        `Error identifying event for ${
          "group" in data ? data.group.id : data.actor_id
        }: ${error.message}`
      )
    }
  }
}

View on GitHub (pinned to 5e06e544a2)

Solutions

  1. Read the wrapped error.message for the provider's own failure reason
  2. Validate the credentials and endpoint configured for the analytics provider
  3. Check that actor_id/group and traits match the provider's expected payload shape
  4. Retry if the provider failure was transient
Defensive patterns

Strategy: try-catch

Try / catch

try {
  await analyticsService.identify({ actor_id: userId, ... })
} catch (e) {
  if (e.type === 'unexpected_state' && /^Error identifying event/.test(e.message)) {
    logger.warn(`analytics identify failed: ${e.message}`)
    return
  }
  throw e
}

Prevention

When it happens

Trigger: Calling analyticsModuleService.identify({actor_id/group, ...}) where the provider rejects the request — bad credentials, unreachable service, invalid traits/actor payload.

Common situations: Misconfigured provider credentials in module options; provider outage; group/actor payload with fields the provider rejects (wrong types, missing required traits).

Related errors


AI-assisted analysis of medusajs/medusa@5e06e544a2 (2026-08-27). Data as JSON: /api/errors/7e7c413e789c2ae2. Report an issue: GitHub.