{"record":{"id":"18c60a485942da00","repo":"medusajs/medusa","slug":"displays-is-not-an-array-the-displays-propert","errorCode":null,"errorMessage":"'displays' is not an array. The 'displays' property must be an array of objects.","messagePattern":"'displays' is not an array\\. The 'displays' property must be an array of objects\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/admin/admin-vite-plugin/src/custom-fields/generate-custom-field-displays.ts","lineNumber":205,"sourceCode":"  index: number,\n  file: string\n): CustomFieldDisplay[] | null {\n  const configArgument = getConfigArgument(path)\n\n  if (!configArgument) {\n    return null\n  }\n\n  const displayProperty = configArgument.properties.find(\n    (p) => isObjectProperty(p) && isIdentifier(p.key, { name: \"displays\" })\n  ) as ObjectProperty | undefined\n\n  if (!displayProperty) {\n    return null\n  }\n\n  if (!isArrayExpression(displayProperty.value)) {\n    logger.warn(\n      `'displays' is not an array. The 'displays' property must be an array of objects.`,\n      { file }\n    )\n    return null\n  }\n\n  const displays: CustomFieldDisplay[] = []\n\n  displayProperty.value.elements.forEach((element, j) => {\n    if (!isObjectExpression(element)) {\n      return\n    }\n\n    const zoneProperty = element.properties.find(\n      (p) => isObjectProperty(p) && isIdentifier(p.key, { name: \"zone\" })\n    ) as ObjectProperty | undefined\n\n    if (!zoneProperty) {","sourceCodeStart":187,"sourceCodeEnd":223,"githubUrl":"https://github.com/medusajs/medusa/blob/5e06e544a296b9033f20f71f11c559f81a0e5739/packages/admin/admin-vite-plugin/src/custom-fields/generate-custom-field-displays.ts#L187-L223","documentation":"Inside getDisplays, after finding the 'displays' property of the config export, the plugin checks that its value is an array expression in the AST. If displays is anything else (an object, an identifier referencing an array defined elsewhere, or missing braces), the config is rejected with this warning because entries cannot be enumerated.","triggerScenarios":"A display config where displays is defined via a variable reference (const entries = [...]; export default { displays: entries }), an object literal, or otherwise not an inline array literal.","commonSituations":"Refactoring configs to share arrays between files; importing display entries from another module; typos like displays: {...} instead of [...].","solutions":["Inline the array literally under displays: [ ... ] in the default export of the file named in the warning","Move any per-entry objects into the literal array, each with zone and component properties","Avoid referencing external variables for the array itself"],"exampleFix":"// before\nconst entries = [\n  { zone: \"general\", component: \"/src/admin/components/x\" },\n]\nexport default { model: \"brand\", link: \"...\", displays: entries }\n\n// after\nexport default {\n  model: \"brand\",\n  link: \"...\",\n  displays: [\n    { zone: \"general\", component: \"/src/admin/components/x\" },\n  ],\n}","handlingStrategy":"validation","validationCode":"if (!Array.isArray(cfg.displays)) {\n  throw new Error(\"'displays' must be an inline array literal in the config file\")\n}","typeGuard":"const hasDisplayArray = (c: unknown): c is { displays: unknown[] } =>\n  typeof c === \"object\" && c !== null && Array.isArray((c as any).displays)","tryCatchPattern":"null","preventionTips":["Inline the displays array in the config file; the generator only reads literals","Avoid importing/referencing shared arrays in generator-parsed files","Add a unit test asserting the config object literal shape"],"tags":["custom-fields","admin-vite-plugin","display-config","ast-parsing"],"backgroundTag":"invalid-custom-field-config","analyzedSha":"5e06e544a296b9033f20f71f11c559f81a0e5739","analyzedAt":"2026-08-27T07:24:39.599Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}