medusajs/medusa · warning

'zone' property is not a valid injection zone.

Error message

'zone' property is not a valid injection zone.

What it means

After collecting zone strings from the config, each is checked against the list of valid admin injection zones (e.g. product.details.after, customer.details.before...). If none of the provided strings is a valid zone, the widget is skipped with this warning.

Source

Thrown at packages/admin/admin-vite-plugin/src/widgets/generate-widgets.ts:312

          )
          if (zoneProperty?.type === "ObjectProperty") {
            extractZoneValues(zoneProperty.value, zones, file)
            zoneFound = true
          }
        }
      }
    },
  })

  if (!zoneFound) {
    logger.warn(`'zone' property is missing from the widget config.`, { file })
    return null
  }

  const validatedZones = zones.filter(isValidInjectionZone)

  if (validatedZones.length === 0) {
    logger.warn(`'zone' property is not a valid injection zone.`, {
      file,
    })
    return null
  }

  return validatedZones
}

function extractZoneValues(value: Node, zones: string[], file: string) {
  if (isTemplateLiteral(value)) {
    logger.warn(
      `'zone' property cannot be a template literal (e.g. \`product.details.after\`).`,
      { file }
    )
    return
  }

  if (isStringLiteral(value)) {

View on GitHub (pinned to 5e06e544a2)

Solutions

  1. Use a valid injection zone string; check the InjectionZone enum in @medusajs/admin-sdk for the exact list
  2. Prefer the enum constant, e.g. zone: InjectionZone.ProductDetailsAfter, but written as a string literal if using defineWidgetConfig
  3. Upgrade @medusajs/admin-vite-plugin if the zone was added recently

Example fix

// before
export const config = defineWidgetConfig({ zone: "product.details.afters" })

// after
export const config = defineWidgetConfig({ zone: "product.details.after" })
Defensive patterns

Strategy: validation

Validate before calling

import { InjectionZone } from "@medusajs/admin-sdk"
const valid = new Set<string>(Object.values(InjectionZone))
const zones = Array.isArray(config.zone) ? config.zone : [config.zone]
if (!zones.some(z => valid.has(z))) throw new Error(`No valid injection zone in ${zones.join(",")}`)

Type guard

const isValidZone = (z: string): z is InjectionZone =>
  Object.values(InjectionZone).includes(z as InjectionZone)

Prevention

When it happens

Trigger: Passing misspelled or unsupported zones like "product.details.afters", "order.side", or a zone removed/renamed in the current admin version.

Common situations: See trigger scenarios.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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