{"record":{"id":"e23642321e7227de","repo":"medusajs/medusa","slug":"model-is-invalid-the-model-property-must-be-a","errorCode":null,"errorMessage":"'model' is invalid. The 'model' property must be a string literal, e.g. 'product' or 'customer'.","messagePattern":"'model' is invalid\\. The 'model' property must be a string literal, e\\.g\\. 'product' or 'customer'\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/admin/admin-vite-plugin/src/custom-fields/helpers.ts","lineNumber":46,"sourceCode":"\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(\n      `'model' is invalid, received: ${model}. The 'model' property must be set to a valid model, e.g. 'product' or 'customer'.`,\n      { file }\n    )\n    return null\n  }\n\n  return model\n}","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/medusajs/medusa/blob/5e06e544a296b9033f20f71f11c559f81a0e5739/packages/admin/admin-vite-plugin/src/custom-fields/helpers.ts#L28-L64","documentation":"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.","triggerScenarios":"Passing a variable instead of a literal in the config: `model: myModelVar` or `model: someObject.model`, or omitting quotes entirely.","commonSituations":"Developer imports a model constant and references it in the config; or reuses a shared config object built programmatically.","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"],"exampleFix":"// before\nimport { myModel } from \"./model\"\nexport default defineCustomFieldConfig({ model: myModel })\n\n// after\nexport default defineCustomFieldConfig({ model: \"product\" })","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"// config values must be inline literals for the vite plugin\n// (checked by the plugin; nothing to guard at runtime)","tryCatchPattern":null,"preventionTips":["Never reference variables or imports in admin codegen configs — inline string literals only","Keep config.ts files tiny and free of logic"],"tags":["admin","custom-fields","static-analysis","ast"],"backgroundTag":"build-time-static-analysis","analyzedSha":"5e06e544a296b9033f20f71f11c559f81a0e5739","analyzedAt":"2026-08-27T07:24:39.599Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}