# Vue: [Vue warn]: Set operation on key "name" failed: target is readonly.

**Code:** `[Vue warn]: Set operation on key failed: target is readonly` · **Category:** Vue · **Seen on:** Vue

You mutated a readonly reactive object (props, `readonly()`, `shallowReadonly`, or a frozen/store state).

## Meaning

Props are readonly: emit an event or copy to local state. For Pinia/Vuex store state use actions/mutations. If you called `readonly(obj)` intentionally, mutate the original object instead of the readonly proxy.

## Common causes

- Mutating `props.user.name`
- Assigning to a `readonly()` proxy
- `provide(key, readonly(state))` mutated in a child
- Vuex strict mode
- Frozen objects

## Quick fix

1. Emit changes to the parent (`emit("update:user", copy)`)
2. Copy props into local refs (`structuredClone`/`ref({...props.user})`)
3. Mutate via store actions

## Detailed fix by platform

### Vue

1. `const local = reactive({ ...props.user });`

## How to diagnose

1. **Target** — Props/readonly?
2. **Mutation** — Direct?
3. **Fix** — Emit/copy?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/vue/vue-warn-set-operation-on-key-failed-target-is-readonly)
