# Vuex (strict mode): Error: [vuex] do not mutate vuex store state outside mutation handlers.

**Code:** `Error: [vuex] do not mutate vuex store state outside mutation handlers` · **Category:** Vue · **Seen on:** Vue

Store state was modified directly (in a component or action) while strict mode is on.

## Meaning

Change state only inside mutations (`commit`). Copy state before editing (`structuredClone`/`JSON.parse(JSON.stringify())`) for local forms; `v-model` directly on store state triggers this — use a computed with get/set that commits. Turn off `strict` in production for performance.

## Common causes

- `this.$store.state.user.name = "A"`
- `v-model="$store.state.x"`
- Mutating objects from state in a component
- Action mutating state directly
- Third-party code modifying store objects

## Quick fix

1. `commit("SET_NAME", value)` in mutations
2. Computed get/set committing for `v-model`
3. Clone before local modification

## Detailed fix by platform

### Vue

1. `computed: { name: { get() { return this.$store.state.user.name }, set(v) { this.$store.commit("SET_NAME", v) } } }`

## How to diagnose

1. **Change** — In mutation?
2. **v-model** — Computed?
3. **Clone** — Used?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/vue/vuex-do-not-mutate-vuex-store-state-outside-mutation-handlers)
