Vue Debugging
Process
- Get the exact message. Copy the full console output, including the component trace under a
[Vue warn]. Look it up in warnings first; it maps the common messages to a cause and a guide. - Reproduce in the smallest place. Narrow the bug to one component and one interaction before changing code. If it only happens after a refresh on an SSR page, treat it as a hydration problem.
- Find the symptom in debug-index when there is no message. It is grouped by area (reactivity, watchers, templates, slots, SSR and more) and phrased as symptoms, for example "watcher never triggers for reactive object properties".
- Fix the cause, not the warning. Do not silence a warning with
inheritAttrs: false, akeychange ornextTickunless the guide says that is the fix. - Confirm the fix. Re-run the reproduction, check the console is clean, and add a test when the bug could come back (
vueskill, testing guide).
Tools that save time
- Vue DevTools (browser extension, or
vite-plugin-vue-devtoolsin Vite): inspect component state, Pinia stores, router state and the timeline of events and mutations. onRenderTracked/onRenderTriggered, and theonTrack/onTriggeroptions oncomputedandwatch, log which dependency caused an update. They run in development builds only. See reactivity-debugging-hooks.app.config.errorHandlerandapp.config.warnHandlercentralize reporting.onErrorCapturedstops errors at a component boundary.- Hydration mismatch details: since Vue 3.4 the warning names the mismatched node and attribute. In production builds, set
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: truein the bundlerdefineto keep those details.
Common root causes, ranked by how often they show up
- Reactivity lost through destructuring, or by replacing a
reactive()object. - Reading the DOM before it updates (missing
await nextTick(), wrong watcherflush). - Side effects inside
computedor template function calls. - Undeclared emits or fallthrough attributes on multi-root components.
- Browser-only APIs or random values during SSR, which cause hydration mismatches.
- Module-level state shared across SSR requests.
Related: vue-performance for slowness and memory leaks, nuxt for Nuxt-specific SSR errors, vue-a11y for focus and screen reader bugs.
