{"record":{"id":"ad146211ad8e2f2c","repo":"medusajs/medusa","slug":"model-property-cannot-be-a-template-literal-e-g","errorCode":null,"errorMessage":"'model' property cannot be a template literal (e.g. `product`).","messagePattern":"'model' property cannot be a template literal \\(e\\.g\\. `product`\\)\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/admin/admin-vite-plugin/src/custom-fields/helpers.ts","lineNumber":38,"sourceCode":"  path: NodePath<ExportDefaultDeclaration>,\n  file: string\n): CustomFieldModel | null {\n  const configArgument = getConfigArgument(path)\n\n  if (!configArgument) {\n    return null\n  }\n\n  const modelProperty = configArgument.properties.find(\n    (p) => isObjectProperty(p) && isIdentifier(p.key, { name: \"model\" })\n  ) as ObjectProperty | undefined\n\n  if (!modelProperty) {\n    return null\n  }\n\n  if (isTemplateLiteral(modelProperty.value)) {\n    logger.warn(\n      `'model' property cannot be a template literal (e.g. \\`product\\`).`,\n      { file }\n    )\n    return null\n  }\n\n  if (!isStringLiteral(modelProperty.value)) {\n    logger.warn(\n      `'model' is invalid. The 'model' property must be a string literal, e.g. 'product' or 'customer'.`,\n      { file }\n    )\n    return null\n  }\n\n  const model = modelProperty.value.value.trim()\n\n  if (!isValidCustomFieldModel(model)) {\n    logger.warn(","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/medusajs/medusa/blob/5e06e544a296b9033f20f71f11c559f81a0e5739/packages/admin/admin-vite-plugin/src/custom-fields/helpers.ts#L20-L56","documentation":"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.","triggerScenarios":"Writing `model: \\`product\\`` (backticks) instead of `model: \"product\"` in src/admin/custom-fields/*/config.ts.","commonSituations":"Copy-pasting from docs or a linter/prettier auto-convert that produced backtick strings; using an interpolated template literal like `prod${uct}`.","solutions":["Change the template literal to a plain string literal: model: \"product\"","Avoid any interpolation or concatenation in the model value","Restart dev server after fixing"],"exampleFix":"// before\nexport default defineCustomFieldConfig({\n  model: `product`,\n})\n\n// after\nexport default defineCustomFieldConfig({\n  model: \"product\",\n})","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use single/double quotes for all values consumed by admin codegen (model, zone, label)","Add an ESLint rule (prefer-string-quotes / no-template-literals where feasible) for admin config files"],"tags":["admin","custom-fields","template-literal","static-analysis"],"backgroundTag":"build-time-static-analysis","analyzedSha":"5e06e544a296b9033f20f71f11c559f81a0e5739","analyzedAt":"2026-08-27T07:24:39.599Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}