{"record":{"id":"daf220ed7a71c9c9","repo":"medusajs/medusa","slug":"model-is-invalid-received-model-the-model","errorCode":null,"errorMessage":"'model' is invalid, received: ${model}. The 'model' property must be set to a valid model, e.g. 'product' or 'customer'.","messagePattern":"'model' is invalid, received: (.+?)\\. The 'model' property must be set to a valid model, 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":56,"sourceCode":"    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}\n\nexport function getConfigArgument(\n  path: NodePath<ExportDefaultDeclaration>\n): ObjectExpression | null {\n  if (!isCallExpression(path.node.declaration)) {\n    return null\n  }\n\n  if (\n    !isIdentifier(path.node.declaration.callee, {","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/medusajs/medusa/blob/5e06e544a296b9033f20f71f11c559f81a0e5739/packages/admin/admin-vite-plugin/src/custom-fields/helpers.ts#L38-L74","documentation":"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.","triggerScenarios":"Passing an unsupported or misspelled model like \"products\", \"Product\", \"collectionss\", or a model that has no admin form support.","commonSituations":"Typos (plural forms), casing mistakes (\"Product\" vs \"product\"), or attempting to add custom fields to a module not yet supported by the admin plugin.","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"],"exampleFix":"// before\nexport default defineCustomFieldConfig({\n  model: \"products\",\n})\n\n// after\nexport default defineCustomFieldConfig({\n  model: \"product\",\n})","handlingStrategy":"validation","validationCode":"import { isValidCustomFieldModel } from \"@medusajs/admin-vite-plugin\"\n// or keep a local allowlist:\nconst VALID = [\"product\", \"customer\", \"order\", \"collection\", \"category\", \"variant\"] as const\nconst model: string = \"product\"\nif (!VALID.includes(model as any)) throw new Error(`Unsupported model: ${model}`)","typeGuard":"const isValidModel = (m: string): m is typeof VALID[number] =>\n  (VALID as readonly string[]).includes(m)","tryCatchPattern":null,"preventionTips":["Check the supported model list in the plugin source (isValidCustomFieldModel) before targeting a model","Use lowercase singular model names"],"tags":["admin","custom-fields","validation","model-name"],"backgroundTag":"invalid-config-value","analyzedSha":"5e06e544a296b9033f20f71f11c559f81a0e5739","analyzedAt":"2026-08-27T07:24:39.599Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}