medusajs/medusa · warning

The subscriber in ${path} has an invalid event config. The e

Error message

The subscriber in ${path} has an invalid event config. The event must be a string or an array of strings. skipped.

What it means

After checking config.event exists, validateSubscriber normalizes it (wrapping a single value into an array) and verifies every entry is a string. If any entry is a non-string (symbol, object, number), the subscriber is skipped with this warning. Note TypeScript types catch this at compile time in .ts files, so it typically appears in .js subscribers or after `any` casts.

Source

Thrown at packages/core/framework/src/subscribers/subscriberLoader.ts:125

    const events = Array.isArray(config.event) ? config.event : [config.event]

    if (events.some((e: unknown) => !(typeof e === "string"))) {
      /**
       * If the subscribers event is not a string or an array of strings, we can't use it
       */
      this.logger.warn(
        `The subscriber in ${path} has an invalid event config. The event must be a string or an array of strings. skipped.`
      )
      return false
    }

View on GitHub (pinned to 5e06e544a2)

Solutions

  1. Make event a string or a plain array of strings: { event: ["cart.created", "cart.updated"] }
  2. Type the export explicitly (export const config: SubscriberConfig = ...) so the compiler rejects non-string events
  3. Remove null/undefined entries from dynamically-built event arrays

Example fix

// before
export const config = { event: [getEventName(), undefined] }

// after
export const config: SubscriberConfig = {
  event: ["order.placed", "order.canceled"],
}
Defensive patterns

Strategy: type-guard

Validate before calling

const events = Array.isArray(config.event) ? config.event : [config.event]
if (events.some((e) => typeof e !== "string")) throw new Error("bad events")

Type guard

const isEventConfig = (e: unknown): e is string | string[] =>
  typeof e === "string" || (Array.isArray(e) && e.every((x) => typeof x === "string"))

Prevention

When it happens

Trigger: export const config = { event: [SomeEnum.VALUE, 123] } where entries are not strings, or event built from an object/undefined element at runtime in a .js subscriber.

Common situations: Passing a variable that is not a string (e.g. a symbol constant or a config object) into event; mixing `as any` casts that defeat type checking; dynamically built event arrays containing nulls.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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