medusajs/medusa · warning
'${name}' property in the 'fields' property at the ${j} inde
Error message
'${name}' property in the 'fields' property at the ${j} index of the 'forms' property in ${file} is malformed. The property must be an object or a call to form.define(). What it means
Inside the 'fields' object, each value must be either a plain object or a call to form.define(...) with a single object argument (checked via AST node types and callee names). A field whose value is neither (e.g. a variable reference, array, or multi-arg call) triggers this warning naming the offending field, and the whole entry is skipped.
Source
Thrown at packages/admin/admin-vite-plugin/src/custom-fields/generate-custom-field-forms.ts:391
return
}
const name = field.key.name
if (
!isObjectExpression(field.value) &&
!(
isCallExpression(field.value) &&
isMemberExpression(field.value.callee) &&
isIdentifier(field.value.callee.object) &&
isIdentifier(field.value.callee.property) &&
field.value.callee.object.name === "form" &&
field.value.callee.property.name === "define" &&
field.value.arguments.length === 1 &&
isObjectExpression(field.value.arguments[0])
)
) {
logger.warn(
`'${name}' property in the 'fields' property at the ${j} index of the 'forms' property in ${file} is malformed. The property must be an object or a call to form.define().`,
{ file }
)
return
}
const fieldObject = isObjectExpression(field.value)
? field.value
: (field.value.arguments[0] as ObjectExpression)
const labelProperty = fieldObject.properties.find(
(p) => isObjectProperty(p) && isIdentifier(p.key, { name: "label" })
) as ObjectProperty | undefined
const descriptionProperty = fieldObject.properties.find(
(p) =>
isObjectProperty(p) && isIdentifier(p.key, { name: "description" })
) as ObjectProperty | undefinedView on GitHub (pinned to 5e06e544a2)
Solutions
- Replace the value with an inline object literal: myField: { label: 'My Field', ... }
- Or use a single-argument form.define({ ... }) call written inline
- Do not reference imported constants or call custom helpers as field values
Example fix
// before
import { myDef } from './defs'
forms: [{ zone: 'general', fields: { myField: myDef } }]
// after
forms: [{ zone: 'general', fields: { myField: form.define({ label: 'My Field' }) } }] Defensive patterns
Strategy: validation
Validate before calling
Object.entries(f.fields).forEach(([name, def]) => {
const ok = (typeof def === 'object' && def !== null) ||
(typeof def === 'function') // form.define call
if (!ok) throw new Error(`field '${name}' must be an object or form.define() call`)
}) Type guard
const isFieldDef = (v: unknown) => (typeof v === 'object' && v !== null) || typeof v === 'function'
Prevention
- Write field definitions inline; do not import them from other modules
- Always call form.define with exactly one object argument
When it happens
Trigger: fields: { myField: someImportedDef } where the value is an Identifier node, or form.define(cfg, extra) with two arguments.
Common situations: Importing field definitions from another file, wrapping definitions in helper functions, or passing form.define a spread/expression instead of a literal object.
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
- 'zone' property at the ${j} index of the 'forms' property is
- 'tab' property at the ${j} index of the 'forms' property is
- The 'fields' property at the ${j} index of the 'forms' prope
- 'forms' property at the ${j} index is malformed. The 'forms'
- 'zone' property at the ${j} index of the 'forms' property ca
AI-assisted analysis of medusajs/medusa@5e06e544a2 (2026-08-27).
Data as JSON: /api/errors/903765c18658ff1e.
Report an issue: GitHub.