medusajs/medusa · warning
'model' is invalid. The 'model' property must be a string li
Error message
'model' is invalid. The 'model' property must be a string literal, e.g. 'product' or 'customer'.
What it means
The admin-vite-plugin statically parses custom field configs and requires the `model` property to be a string literal AST node. If it is an identifier, a variable reference, a member expression, or any other non-literal node, the plugin cannot determine the model name at build time and skips the config with this warning.
Source
Thrown at packages/admin/admin-vite-plugin/src/custom-fields/helpers.ts:46
const modelProperty = configArgument.properties.find(
(p) => isObjectProperty(p) && isIdentifier(p.key, { name: "model" })
) as ObjectProperty | undefined
if (!modelProperty) {
return null
}
if (isTemplateLiteral(modelProperty.value)) {
logger.warn(
`'model' property cannot be a template literal (e.g. \`product\`).`,
{ file }
)
return null
}
if (!isStringLiteral(modelProperty.value)) {
logger.warn(
`'model' is invalid. The 'model' property must be a string literal, e.g. 'product' or 'customer'.`,
{ file }
)
return null
}
const model = modelProperty.value.value.trim()
if (!isValidCustomFieldModel(model)) {
logger.warn(
`'model' is invalid, received: ${model}. The 'model' property must be set to a valid model, e.g. 'product' or 'customer'.`,
{ file }
)
return null
}
return model
}View on GitHub (pinned to 5e06e544a2)
Solutions
- Inline the model name as a string literal: model: "product"
- Do not reference variables, imports, or computed values for the model property
- Restart the dev server to regenerate
Example fix
// before
import { myModel } from "./model"
export default defineCustomFieldConfig({ model: myModel })
// after
export default defineCustomFieldConfig({ model: "product" }) Defensive patterns
Strategy: type-guard
Type guard
// config values must be inline literals for the vite plugin // (checked by the plugin; nothing to guard at runtime)
Prevention
- Never reference variables or imports in admin codegen configs — inline string literals only
- Keep config.ts files tiny and free of logic
When it happens
Trigger: Passing a variable instead of a literal in the config: `model: myModelVar` or `model: someObject.model`, or omitting quotes entirely.
Common situations: Developer imports a model constant and references it in the config; or reuses a shared config object built programmatically.
Related errors
- 'model' property cannot be a template literal (e.g. `product
- 'zone' property is missing from the ${j} index of the 'forms
- 'zone' property at the ${j} index of the 'forms' property is
- 'tab' property at the ${j} index of the 'forms' property is
- 'tab' property at the ${j} index of the 'forms' property is
AI-assisted analysis of medusajs/medusa@5e06e544a2 (2026-08-27).
Data as JSON: /api/errors/e23642321e7227de.
Report an issue: GitHub.