# Vue: [Vue warn]: Unhandled error during execution of mounted hook / TypeError: Cannot read properties of undefined (reading 'x')

**Code:** `[Vue warn]: Unhandled error during execution of setup/mounted hook` · **Category:** Vue · **Seen on:** Vue

An exception was thrown inside a lifecycle hook, watcher, event handler or render, and Vue logs it with the context.

## Meaning

The real cause is the error that follows (TypeError, network error). Read the stack, fix the undefined access (data not loaded, wrong ref), wrap async calls in try/catch, and add `app.config.errorHandler` / `onErrorCaptured` for reporting.

## Common causes

- `undefined` data accessed in setup/mounted
- Async function errors unhandled
- Ref accessed before mount
- Wrong prop usage
- Third-party lib errors

## Quick fix

1. Read the TypeError below the warning and fix that line
2. try/catch around async work
3. Set `app.config.errorHandler` to log centrally

## Detailed fix by platform

### Vue

1. `app.config.errorHandler = (err, instance, info) => { console.error(info, err); };`

## How to diagnose

1. **Hook** — Which?
2. **Error** — Below the warning?
3. **Handler** — Configured?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/vue/vue-warn-unhandled-error-during-execution)
