Meituan-Dianping/mpvue · error

Invalid prop: custom validator check failed for prop "${name

Error message

Invalid prop: custom validator check failed for prop "${name}".

What it means

Raised at the end of assertProp when the prop's custom validator function returns a falsy value. After type checks pass, the user-supplied prop.validator(value) is invoked and must return true; returning false/undefined (including a validator that forgot its return statement) triggers this warning. It signals a value that is structurally the right type but fails the component's own business-rule constraint.

Source

Thrown at src/core/util/props.js:131

    for (let i = 0; i < type.length && !valid; i++) {
      const assertedType = assertType(value, type[i])
      expectedTypes.push(assertedType.expectedType || '')
      valid = assertedType.valid
    }
  }
  if (!valid) {
    warn(
      'Invalid prop: type check failed for prop "' + name + '".' +
      ' Expected ' + expectedTypes.map(capitalize).join(', ') +
      ', got ' + Object.prototype.toString.call(value).slice(8, -1) + '.',
      vm
    )
    return
  }
  const validator = prop.validator
  if (validator) {
    if (!validator(value)) {
      warn(
        'Invalid prop: custom validator check failed for prop "' + name + '".',
        vm
      )
    }
  }
}

const simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/

function assertType (value: any, type: Function): {
  valid: boolean;
  expectedType: string;
} {
  let valid
  const expectedType = getType(type)
  if (simpleCheckRE.test(expectedType)) {
    valid = typeof value === expectedType.toLowerCase()
  } else if (expectedType === 'Object') {

View on GitHub (pinned to 6c5d78ee04)

Solutions

  1. Fix the passed value so it satisfies the validator's rule (e.g. within an allowed list or numeric range)
  2. Review the validator implementation — ensure every branch returns an explicit boolean and constraints match the documented API
  3. If the constraint no longer applies, update or remove the validator from the prop definition
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/core/util/props.js:131 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/e601a3b7c105835d. Report an issue: GitHub.