medusajs/medusa · warning

'model' property is missing.

Error message

'model' property is missing.

What it means

While generating the admin custom-field display configuration, the Vite plugin parses each display file's default export. If the parsed export has no 'model' property (the data model the display attaches to, e.g. "product" or an custom model), the file is skipped with this warning — the display will not appear in the admin.

Source

Thrown at packages/admin/admin-vite-plugin/src/custom-fields/generate-custom-field-displays.ts:168

        if (!_model) {
          return
        }

        model = _model
        displays = getDisplays(path, model, index, file)
        hasLink = validateLink(path, file)
      },
    })
  } catch (err) {
    logger.error(`An error occurred while traversing the file.`, {
      file,
      error: err,
    })
    return null
  }

  if (!model) {
    logger.warn(`'model' property is missing.`, { file })
    return null
  }

  if (!hasLink) {
    logger.warn(`'link' property is missing.`, { file })
    return null
  }

  return {
    import: import_,
    model,
    displays,
  }
}

function getDisplays(
  path: NodePath<ExportDefaultDeclaration>,
  model: CustomFieldModel,

View on GitHub (pinned to 5e06e544a2)

Solutions

  1. Open the file named in the warning ({ file }) and add model: "<model-name>" to the default export
  2. Make sure the export is a plain object literal with statically readable keys (no spreads/computed keys) so the plugin can parse it
  3. Verify the display config matches the documented shape: { model, link, displays: [...] }

Example fix

// before (display.ts)
export default {
  link: "/src/links/product-brand",
  displays: [/* ... */],
}

// after
export default {
  model: "product",
  link: "/src/links/product-brand",
  displays: [/* ... */],
}
Defensive patterns

Strategy: validation

Validate before calling

const cfg = displayConfigDefaultExport
if (!("model" in cfg)) {
  throw new Error("display config is missing 'model' — it will be skipped")
}

Type guard

const hasDisplayModel = (c: unknown): c is { model: string } =>
  typeof c === "object" && c !== null && typeof (c as any).model === "string"

Try / catch

null

Prevention

When it happens

Trigger: A src/admin/custom-fields/<file>/display.ts (or equivalent) whose default export omits the model property, or exports it under a different key/name so the AST lookup fails.

Common situations: Converting a form config to a display config and forgetting model; renaming properties based on outdated docs; destructuring or computed exports the AST parser can't statically read.

Related errors


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