Meituan-Dianping/mpvue · error
Missing required prop: "${name}"
Error message
Missing required prop: "${name}" What it means
Emitted by assertProp (called from validateProp during props initialization) when the prop is marked required: true and the 'absent' flag is set — the parent did not pass the prop and no default exists to fill in (required props ignore defaults in practice, and absence means the key was entirely missing from propsData). Initialization continues with the value undefined, so downstream code reading the prop likely breaks at runtime.
Source
Thrown at src/core/util/props.js:97
// call factory function for non-Function types
// a value is Function if its prototype is function even across different execution context
return typeof def === 'function' && getType(prop.type) !== 'Function'
? def.call(vm)
: def
}
/**
* Assert whether a prop is valid.
*/
function assertProp (
prop: PropOptions,
name: string,
value: any,
vm: ?Component,
absent: boolean
) {
if (prop.required && absent) {
warn(
'Missing required prop: "' + name + '"',
vm
)
return
}
if (value == null && !prop.required) {
return
}
let type = prop.type
let valid = !type || type === true
const expectedTypes = []
if (type) {
if (!Array.isArray(type)) {
type = [type]
}
for (let i = 0; i < type.length && !valid; i++) {
const assertedType = assertType(value, type[i])
expectedTypes.push(assertedType.expectedType || '')View on GitHub (pinned to 6c5d78ee04)
Solutions
- Pass the prop from the parent: <my-comp :item-id="id" />
- If the prop is actually optional, drop required: true and provide a default instead
- Check prop name casing: kebab-case in templates (:item-id) vs camelCase declaration (itemId) — a mismatch makes the prop appear absent
- In tests, supply the prop via propsData or the mounting options
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/core/util/props.js:97 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Meituan-Dianping/mpvue@6c5d78ee04 (2026-09-02).
Data as JSON: /api/errors/8c0f2bea06e2f13f.
Report an issue: GitHub.