medusajs/medusa · warning

'zone' is invalid at index ${j} in the 'displays' property.

Error message

'zone' is invalid at index ${j} in the 'displays' property. Received: ${zone}.

What it means

After extracting the zone string and computing the generated display entry path, the plugin validates the zone against the custom-field display zone whitelist and the path shape. An unknown zone or an invalid derived path skips the entry with this warning, echoing the received zone value.

Source

Thrown at packages/admin/admin-vite-plugin/src/custom-fields/generate-custom-field-displays.ts:246

      return
    }

    if (!isStringLiteral(zoneProperty.value)) {
      logger.warn(
        `'zone' property at index ${j} in the 'displays' property is not a string literal. 'zone' must be a string literal, e.g. 'general' or 'attributes'.`,
        { file }
      )
      return
    }

    const zone = zoneProperty.value.value
    const fullPath = getDisplayEntryPath(model, zone)

    if (
      !isValidCustomFieldDisplayZone(zone) ||
      !isValidCustomFieldDisplayPath(fullPath)
    ) {
      logger.warn(
        `'zone' is invalid at index ${j} in the 'displays' property. Received: ${zone}.`,
        { file }
      )
      return
    }

    const componentProperty = element.properties.find(
      (p) => isObjectProperty(p) && isIdentifier(p.key, { name: "component" })
    ) as ObjectProperty | undefined

    if (!componentProperty) {
      logger.warn(
        `'component' property is missing at index ${j} in the 'displays' property.`,
        { file }
      )
      return
    }

View on GitHub (pinned to 5e06e544a2)

Solutions

  1. Replace the zone with one of the supported custom-field display zones shown in the docs (e.g. "general", "attributes") — see isValidCustomFieldDisplayZone's accepted list
  2. Check the exact spelling/casing of the zone in the flagged entry (index j in the warning)
  3. If you intended a fully custom zone, use the widget system instead, which permits custom zones with a warning

Example fix

// before
displays: [
  { zone: "product-header", component: "/src/..." },
]

// after
displays: [
  { zone: "general", component: "/src/..." },
]
Defensive patterns

Strategy: validation

Validate before calling

import { isValidCustomFieldDisplayZone } from "@medusajs/admin-vite-plugin"
if (!isValidCustomFieldDisplayZone(zone)) {
  throw new Error(`Unsupported display zone: ${zone}`)
}

Type guard

const isSupportedZone = (z: string) =>
  ["general", "attributes"].includes(z) // keep in sync with supported list

Try / catch

null

Prevention

When it happens

Trigger: A zone value that is a valid string literal but not one of the recognized custom-field display zones (e.g. "brandHeader" or a typo like "genral"), producing an invalid entry path.

Common situations: Using core widget injection-zone names that aren't display zones; assuming any custom zone works for displays (unlike widgets, display zones are validated); typos.

Related errors


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