medusajs/medusa · warning

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

Error message

'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'.

What it means

The zone value of a displays entry must be a string literal in the source AST (e.g. "general"), because the code generator embeds it statically into generated output. If zone is a variable, template literal, constant reference, or other expression, the entry is skipped with this warning.

Source

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

  displayProperty.value.elements.forEach((element, j) => {
    if (!isObjectExpression(element)) {
      return
    }

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

    if (!zoneProperty) {
      logger.warn(
        `'zone' property is missing at the ${j} index of the 'displays' property.`,
        { file }
      )
      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

View on GitHub (pinned to 5e06e544a2)

Solutions

  1. Replace the expression with a plain string literal, e.g. zone: "general"
  2. If you need reuse, inline the final string per entry — the plugin only understands literals
  3. Remove backticks/template-literal syntax around the value

Example fix

// before
const ZONE = "general"
displays: [{ zone: ZONE, component: "/src/..." }]

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

Strategy: validation

Validate before calling

null

Type guard

null

Try / catch

null

Prevention

When it happens

Trigger: Writing zone: MY_ZONE, zone: `general`, or zone: getZone() in a displays entry — anything that is not a plain double/single-quoted string in the config file.

Common situations: Wanting to DRY zones into constants; template literals with no interpolation; porting configs written in a more dynamic style.

Related errors


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