medusajs/medusa · warning
The 'forms' property is malformed. The 'forms' property must
Error message
The 'forms' property is malformed. The 'forms' property must be an array of objects.
What it means
This is the getFormsArgument check: when a 'forms' property exists on the plugin/config call but its value is not an array expression, the plugin warns that forms must be an array of objects and returns null so no configs are generated for the file.
Source
Thrown at packages/admin/admin-vite-plugin/src/custom-fields/generate-custom-field-forms.ts:700
path: NodePath<ExportDefaultDeclaration>,
file: string
): ArrayExpression | null {
const configArgument = getConfigArgument(path)
if (!configArgument) {
return null
}
const formProperty = configArgument.properties.find(
(p) => isObjectProperty(p) && isIdentifier(p.key, { name: "forms" })
) as ObjectProperty | undefined
if (!formProperty) {
return null
}
if (!isArrayExpression(formProperty.value)) {
logger.warn(
`The 'forms' property is malformed. The 'forms' property must be an array of objects.`,
{ file }
)
return null
}
return formProperty.value
}
View on GitHub (pinned to 5e06e544a2)
Solutions
- Wrap entries in an array: forms: [{ zone: 'general', fields: { ... } }]
- Inline the array literal rather than computing it
- Verify every element is an object literal
Example fix
// before
forms: { zone: 'general', fields: { ... } }
// after
forms: [{ zone: 'general', fields: { ... } }] Defensive patterns
Strategy: type-guard
Validate before calling
if (!Array.isArray(config.forms)) {
throw new Error('forms must be an array of form entry objects')
} Type guard
const isFormsArray = (v: unknown): v is unknown[] => Array.isArray(v)
Prevention
- Always bracket form entries, even for a single form
- Keep the forms value as a literal array in the config file
When it happens
Trigger: forms: { zone: 'general', ... } (single object instead of array), forms: getForms(), or forms: someConstant.
Common situations: Wrapping a single form in an object because there is only one, or assigning a computed/imported value.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- The 'fields' property at the ${j} index of the 'forms' prope
- 'forms' property at the ${j} index is malformed. The 'forms'
- 'fields' property at the ${j} index of the 'forms' property
- 'zone' property is missing from the ${j} index of the 'forms
- 'zone' property at the ${j} index of the 'forms' property is
AI-assisted analysis of medusajs/medusa@5e06e544a2 (2026-08-27).
Data as JSON: /api/errors/586fe895d8945f21.
Report an issue: GitHub.