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 }
)
returnView on GitHub (pinned to 5e06e544a2)
Solutions
- Replace the expression with a plain string literal, e.g. zone: "general"
- If you need reuse, inline the final string per entry — the plugin only understands literals
- 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
- Write zone values as plain string literals, never variables or template literals
- Keep configs simple — the generator is a static AST reader, not a runtime evaluator
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
- 'displays' is not an array. The 'displays' property must be
- 'zone' property at the ${j} index of the 'forms' property is
- 'tab' property at the ${j} index of the 'forms' property is
- 'zone' property at the ${j} index of the 'forms' property is
- 'model' property is missing.
AI-assisted analysis of medusajs/medusa@5e06e544a2 (2026-08-27).
Data as JSON: /api/errors/cc02a38334868c1a.
Report an issue: GitHub.