Vue 2: [Vue warn]: Avoid adding reactive properties to a Vue instance or its root $data at runtime - declare it upfront in the data option
In Vue 2 you added a property to the root data (or instance) after creation, which can't be made reactive.
[Vue warn]: Avoid adding reactive properties to a Vue instance or its root $data at runtime - declare it upfront in the data option.Avoid adding reactive properties to a Vue instance or its root $data at runtime[Vue warn]: Avoid adding reactive properties to a Vue instance or its root $dataVue.set cannot set reactive property on undefined, null, or primitive value Meaning
Declare every top-level property in data() upfront (even as null), or use Vue.set(this.obj, "key", value)/this.$set for nested additions. Vue 3 (Proxy reactivity) removed these limitations — consider migrating.
Common causes
this.newProp = ...not declared in data- Adding keys to
this.$data - Vue 2 reactivity caveats (new object properties, array index set)
- Misuse of
$seton root - Migrating from Vue 3 habits
⚡ Quick fix
- Declare in
data()upfront (initialisenull) this.$set(this.user, "age", 30)for nested objects- Use
splicefor array changes in Vue 2
Detailed fix by platform
Vue
data() { return { user: { name: "" }, selected: null } }
How to diagnose
- Property — Declared?
- Nested — $set?
- Version — Vue 2?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- [Vue warn]: Error in v-on handler / Error in mounted hook (Vue 2) Vue 2: [Vue warn]: Error in v-on handler: "TypeError: Cannot read property 'x' of undefined"
- [Vue warn]: Maximum recursive updates exceeded Vue: [Vue warn]: Maximum recursive updates exceeded in component <Foo>. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself
- [Vue warn]: Set operation on key failed: target is readonly Vue: [Vue warn]: Set operation on key "name" failed: target is readonly.
Most viewed in Vue
- Failed to resolve component Vue: [Vue warn]: Failed to resolve component: x
- Nuxt: window/document/localStorage is not defined (SSR) Nuxt: ReferenceError: window is not defined / 500 Internal Server Error during SSR
- getActivePinia() was called but there was no active Pinia Pinia: Error: [🍍]: "getActivePinia()" was called but there was no active Pinia. Are you trying to use a store before calling "app.use(pinia)"?
Other ways to find it
Where this error sits
Origin: On your device. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 5 Nov 2026