medusajs/medusa · warning

'forms' property is missing.

Error message

'forms' property is missing.

What it means

For custom-field form configs (the getFormConfig flow), the plugin looks for the 'forms' argument in the admin plugin call. If it is absent entirely (getFormsArgument returns null), this warning is logged and no configs are generated for that file.

Source

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

function getFormEntryFieldPath(
  model: CustomFieldModel,
  zone: string,
  tab?: string
): string {
  return `${model}.${zone}.${tab ? `${tab}.` : ""}$field`
}

function getConfigs(
  path: NodePath<ExportDefaultDeclaration>,
  model: CustomFieldModel,
  index: number,
  file: string
): CustomFieldConfig[] | null {
  const formArray = getFormsArgument(path, file)

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

  const configs: CustomFieldConfig[] = []

  formArray.elements.forEach((element, j) => {
    if (!isObjectExpression(element)) {
      logger.warn(
        `'forms' property at the ${j} index is malformed. The 'forms' property must be an object.`,
        { file }
      )
      return
    }

    const zoneProperty = element.properties.find(
      (p) => isObjectProperty(p) && isIdentifier(p.key, { name: "zone" })
    ) as ObjectProperty | undefined

View on GitHub (pinned to 5e06e544a2)

Solutions

  1. Add a forms: [...] array to the plugin/config call in the file indicated by {file}
  2. Check the property is spelled exactly 'forms'
  3. Remove the file from the custom-fields source directory if it is not meant to be a form config

Example fix

// before
export default defineConfig({})
// after
export default defineConfig({
  forms: [{ zone: 'general', tab: 'general', fields: { ... } }],
})
Defensive patterns

Strategy: validation

Validate before calling

if (!config.forms) throw new Error("config file must export a 'forms' array")

Type guard

const hasForms = (c: unknown): c is { forms: unknown[] } =>
  typeof c === 'object' && c !== null && 'forms' in (c as object)

Prevention

When it happens

Trigger: Exporting a module from the admin custom-fields directory that never calls the plugin with a forms property, or misspelling 'forms' as 'Forms'/'form'.

Common situations: Adding a barrel/index file under src/admin, starting a config file from an empty template, or a typo in the property name.

Related errors


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