medusajs/medusa · warning

The 'fields' property is missing at the ${j} index of the 'f

Error message

The 'fields' property is missing at the ${j} index of the 'forms' property. The 'fields' property is required to load a custom field form.

What it means

Each entry in the 'forms' array must declare a 'fields' object mapping field names to their form definitions. When the entry at index j has no 'fields' key, there is nothing to render, so the plugin warns and skips the entry.

Source

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

    const fullPath = getFormEntryFieldPath(model, zone, tab)

    if (
      !isValidCustomFieldFormZone(zone) ||
      !isValidCustomFieldFormFieldPath(fullPath)
    ) {
      logger.warn(
        `'zone' and 'tab' properties at the ${j} index of the 'forms' property are not a valid for the '${model}' model. Received: { zone: ${zone}, tab: ${tab} }.`,
        { file }
      )
      return
    }

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

    if (!fieldsObject) {
      logger.warn(
        `The 'fields' property is missing at the ${j} index of the 'forms' property. The 'fields' property is required to load a custom field form.`,
        { file }
      )
      return
    }

    const fields: CustomFieldFormField[] = []

    if (!isObjectExpression(fieldsObject.value)) {
      logger.warn(
        `The 'fields' property at the ${j} index of the 'forms' property is malformed. The 'fields' property must be an object.`,
        { file }
      )
      return
    }

    fieldsObject.value.properties.forEach((field) => {
      if (!isObjectProperty(field) || !isIdentifier(field.key)) {

View on GitHub (pinned to 5e06e544a2)

Solutions

  1. Add a fields object: fields: { myField: form.define({ ... }) } or { myField: { ... } }
  2. Ensure 'fields' is a sibling of 'zone'/'tab', not nested inside them
  3. Check for typos in the property name

Example fix

// before
forms: [{ zone: 'general', tab: 'general' }]
// after
forms: [{ zone: 'general', tab: 'general', fields: { subtitle: form.define({ label: 'Subtitle' }) } }]
Defensive patterns

Strategy: validation

Validate before calling

if (!f.fields || typeof f.fields !== 'object' || Array.isArray(f.fields)) {
  throw new Error('every forms entry needs a fields object')
}

Type guard

const hasFields = (f: unknown): f is { fields: Record<string, unknown> } =>
  typeof f === 'object' && f !== null && 'fields' in (f as object)

Prevention

When it happens

Trigger: forms: [{ zone: 'general', tab: 'general' }] with no fields key, or naming it 'field', 'components', or 'inputs'.

Common situations: Skeleton config committed before adding fields, renaming the key while refactoring, or nesting fields one level too deep.

Related errors


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