medusajs/medusa · warning
'validation' property is missing at the ${j} index of the 'f
Error message
'validation' property is missing at the ${j} index of the 'forms' property in ${file}. What it means
Field configs must declare a 'validation' property (a function validating input). If a field object has defaultValue but no validation, the plugin warns with the entry index and file and skips the entry, because it cannot generate a complete config.
Source
Thrown at packages/admin/admin-vite-plugin/src/custom-fields/generate-custom-field-forms.ts:641
(p) =>
isObjectProperty(p) && isIdentifier(p.key, { name: "defaultValue" })
) as ObjectProperty | undefined
if (!defaultValueProperty) {
logger.warn(
`'defaultValue' property is missing at the ${j} index of the 'forms' property in ${file}.`,
{ file }
)
return
}
const validationProperty = fieldObject.properties.find(
(p) =>
isObjectProperty(p) && isIdentifier(p.key, { name: "validation" })
) as ObjectProperty | undefined
if (!validationProperty) {
logger.warn(
`'validation' property is missing at the ${j} index of the 'forms' property in ${file}.`,
{ file }
)
return
}
const defaultValue = getFormFieldValue(index, j, name, "defaultValue")
const validation = getFormFieldValue(index, j, name, "validation")
fields.push({
name,
defaultValue,
validation,
})
})
configs.push({
zone: zone,View on GitHub (pinned to 5e06e544a2)
Solutions
- Add a validation function: validation: (value) => true or a real rule
- Ensure both defaultValue and validation exist on every field
- Return a string/message from validation to surface errors, or true on success
Example fix
// before
fields: { myField: { defaultValue: '' } }
// after
fields: { myField: { defaultValue: '', validation: (v) => v.length < 100 } } Defensive patterns
Strategy: validation
Validate before calling
Object.entries(f.fields).forEach(([name, def]) => {
if (typeof def !== 'object' || !('validation' in def)) {
throw new Error(`field '${name}' is missing validation`)
}
}) Type guard
const hasValidation = (d: unknown): d is { validation: (v: unknown) => true | string } =>
typeof d === 'object' && d !== null && 'validation' in (d as object) Prevention
- Require validation explicitly, even if it is a trivial (v) => true
- Use a shared FieldConfig type so missing keys fail typecheck
When it happens
Trigger: fields: { myField: { defaultValue: '' } } with no validation key.
Common situations: Assuming validation is optional, or writing a field config from a form.define example that omitted it.
Related errors
- 'zone' property is missing from the ${j} index of the 'forms
- 'tab' property at the ${j} index of the 'forms' property is
- 'zone' and 'tab' properties at the ${j} index of the 'forms'
- The 'fields' property is missing at the ${j} index of the 'f
- The 'fields' property at the ${j} index of the 'forms' prope
AI-assisted analysis of medusajs/medusa@5e06e544a2 (2026-08-27).
Data as JSON: /api/errors/26e13d00eb327856.
Report an issue: GitHub.