medusajs/medusa · warning

'zone' property at the ${j} index of the 'forms' property is

Error message

'zone' property at the ${j} index of the 'forms' property is not a string literal (e.g. 'general' or 'attributes').

What it means

The 'zone' value must be a plain string literal; identifiers, expressions, template literals (covered by the previous check), and other node types all fail this final isStringLiteral check in the getConfig flow, producing this warning and skipping the entry.

Source

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

    if (!zoneProperty) {
      logger.warn(
        `'zone' property is missing from the ${j} index of the 'forms' property.`,
        { file }
      )
      return
    }

    if (isTemplateLiteral(zoneProperty.value)) {
      logger.warn(
        `'zone' property at the ${j} index of the 'forms' property cannot be a template literal (e.g. \`general\`).`,
        { file }
      )
      return
    }

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

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

    if (
      !isValidCustomFieldFormZone(zone) ||
      !isValidCustomFieldFormConfigPath(fullPath)
    ) {
      logger.warn(
        `'zone' property at the ${j} index of the 'forms' property is not a valid custom field form zone for the '${model}' model. Received: ${zone}.`
      )
      return
    }

View on GitHub (pinned to 5e06e544a2)

Solutions

  1. Inline the literal: zone: 'general'
  2. Duplicate the literal string per entry instead of referencing constants
  3. Keep config files fully static

Example fix

// before
forms: [{ zone: ZONES.general, fields: { ... } }]
// after
forms: [{ zone: 'general', fields: { ... } }]
Defensive patterns

Strategy: validation

Validate before calling

forms.forEach((f, i) => {
  if (typeof f.zone !== 'string') throw new Error(`forms[${i}].zone must be an inline string literal`)
})

Type guard

const isLiteralString = (v: unknown): v is string => typeof v === 'string'

Prevention

When it happens

Trigger: zone: ZONES.general, zone: 'gen' + 'eral', or zone: getZone().

Common situations: Centralizing zone names in an enum/constant object, or building configs with helper functions.

Related errors


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