medusajs/medusa · warning
'model' is invalid, received: ${model}. The 'model' property
Error message
'model' is invalid, received: ${model}. The 'model' property must be set to a valid model, e.g. 'product' or 'customer'. What it means
After confirming the `model` property is a string literal, the plugin validates its trimmed value against the list of models that support admin custom fields (e.g. product, customer, order...). If the string is not one of the supported models, the config is rejected with this warning naming the received value.
Source
Thrown at packages/admin/admin-vite-plugin/src/custom-fields/helpers.ts:56
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
}
export function getConfigArgument(
path: NodePath<ExportDefaultDeclaration>
): ObjectExpression | null {
if (!isCallExpression(path.node.declaration)) {
return null
}
if (
!isIdentifier(path.node.declaration.callee, {View on GitHub (pinned to 5e06e544a2)
Solutions
- Correct the model string to a supported lowercase model name such as "product" or "customer"
- Check the plugin's valid model list (isValidCustomFieldModel) for supported models in your version
- If the model is unsupported, upgrade @medusajs/admin-vite-plugin — newer versions add more models
Example fix
// before
export default defineCustomFieldConfig({
model: "products",
})
// after
export default defineCustomFieldConfig({
model: "product",
}) Defensive patterns
Strategy: validation
Validate before calling
import { isValidCustomFieldModel } from "@medusajs/admin-vite-plugin"
// or keep a local allowlist:
const VALID = ["product", "customer", "order", "collection", "category", "variant"] as const
const model: string = "product"
if (!VALID.includes(model as any)) throw new Error(`Unsupported model: ${model}`) Type guard
const isValidModel = (m: string): m is typeof VALID[number] => (VALID as readonly string[]).includes(m)
Prevention
- Check the supported model list in the plugin source (isValidCustomFieldModel) before targeting a model
- Use lowercase singular model names
When it happens
Trigger: Passing an unsupported or misspelled model like "products", "Product", "collectionss", or a model that has no admin form support.
Common situations: Typos (plural forms), casing mistakes ("Product" vs "product"), or attempting to add custom fields to a module not yet supported by the admin plugin.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- 'validation' property is missing at the ${j} index of the 'f
- 'link' property is missing.
- No product ids passed to remove from price list
- Invalid rule attribute - ${ruleAttributeId}
- Invalid param rule_type (${ruleType})
AI-assisted analysis of medusajs/medusa@5e06e544a2 (2026-08-27).
Data as JSON: /api/errors/daf220ed7a71c9c9.
Report an issue: GitHub.