Meituan-Dianping/mpvue · error

Property or method "${key}" is not defined on the instance b

Error message

Property or method "${key}" is not defined on the instance but referenced during render. Make sure to declare reactive data properties in the data option.

What it means

Emitted by warnNonPresent, the handler behind the dev-only initProxy Proxy that wraps component instances (_renderProxy). During rendering, a 'has' or 'get' trap on the proxy intercepted a property access (key) that exists neither on the instance nor in the allowedGlobals whitelist (Infinity, Math, Date, require, etc.). The render function references something Vue never defined — usually an undeclared data property, a misspelled property, or a global like a browser API used directly in the template.

Source

Thrown at src/core/instance/proxy.js:17

/* not type checking this file because flow doesn't play well with Proxy */

import config from 'core/config'
import { warn, makeMap } from '../util/index'

let initProxy

if (process.env.NODE_ENV !== 'production') {
  const allowedGlobals = makeMap(
    'Infinity,undefined,NaN,isFinite,isNaN,' +
    'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
    'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
    'require' // for Webpack/Browserify
  )

  const warnNonPresent = (target, key) => {
    warn(
      `Property or method "${key}" is not defined on the instance but ` +
      `referenced during render. Make sure to declare reactive data ` +
      `properties in the data option.`,
      target
    )
  }

  const hasProxy =
    typeof Proxy !== 'undefined' &&
    Proxy.toString().match(/native code/)

  if (hasProxy) {
    const isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta')
    config.keyCodes = new Proxy(config.keyCodes, {
      set (target, key, value) {
        if (isBuiltInModifier(key)) {
          warn(`Avoid overwriting built-in modifier in config.keyCodes: .${key}`)
          return false

View on GitHub (pinned to 6c5d78ee04)

Solutions

  1. Declare the property in data() with an initial value so it is reactive and proxied on the instance
  2. If it derives from other state, make it a computed property instead
  3. For non-reactive constants used in templates, reference them via a computed or a method — plain globals and undeclared variables are blocked by the proxy whitelist
  4. Check spelling/case of the property name in the template versus the script
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/core/instance/proxy.js:17 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/54c28c7b0ea3f632. Report an issue: GitHub.