medusajs/medusa · warning

'model' property cannot be a template literal (e.g. `product

Error message

'model' property cannot be a template literal (e.g. `product`).

What it means

When parsing the `model` property of a custom field config, the admin-vite-plugin requires a plain string literal because it needs the static value at build time to generate imports. Template literals (backticks) are AST nodes whose values cannot be reliably evaluated during static analysis, so the plugin warns and returns null, skipping the custom field.

Source

Thrown at packages/admin/admin-vite-plugin/src/custom-fields/helpers.ts:38

  path: NodePath<ExportDefaultDeclaration>,
  file: string
): CustomFieldModel | null {
  const configArgument = getConfigArgument(path)

  if (!configArgument) {
    return null
  }

  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(

View on GitHub (pinned to 5e06e544a2)

Solutions

  1. Change the template literal to a plain string literal: model: "product"
  2. Avoid any interpolation or concatenation in the model value
  3. Restart dev server after fixing

Example fix

// before
export default defineCustomFieldConfig({
  model: `product`,
})

// after
export default defineCustomFieldConfig({
  model: "product",
})
Defensive patterns

Strategy: validation

Prevention

When it happens

Trigger: Writing `model: \`product\`` (backticks) instead of `model: "product"` in src/admin/custom-fields/*/config.ts.

Common situations: Copy-pasting from docs or a linter/prettier auto-convert that produced backtick strings; using an interpolated template literal like `prod${uct}`.

Related errors


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