medusajs/medusa · warning

'model' property is missing.

Error message

'model' property is missing.

What it means

The forms counterpart to the display generator: when parsing a custom-field form config file, the plugin requires a 'model' property identifying the data model the form attaches to. A missing or unparseable model causes the file to be skipped with this warning, so the form never shows in the admin.

Source

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

          return
        }

        model = _model
        hasLink = validateLink(path, file) // Add this line to validate link
        configs = getConfigs(path, model, index, file)
        forms = getForms(path, model, index, 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,
    configs,
    forms,
  }
}

function generateCustomFieldConfigName(index: number): string {
  return `CustomFieldConfig${index}`

View on GitHub (pinned to 5e06e544a2)

Solutions

  1. Add model: "<model-name>" to the default export in the file flagged by the warning
  2. Keep the export a plain object literal with statically readable keys
  3. Match the documented form config shape: { model, link, forms: [...] }

Example fix

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

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

Strategy: validation

Validate before calling

if (typeof cfg.model !== "string") {
  throw new Error("form config is missing 'model' — it will be skipped")
}

Type guard

const hasFormModel = (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/<name>/config.ts (form config) whose default export lacks model, or exports it in a way the static AST parse cannot see (spread, computed key, variable).

Common situations: Starting a form config from the display example and forgetting model; renaming after an API change; sharing config objects between files.

Related errors


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