Vuex mutation throws an error - do not mutate vuex store state outside mutation handlers

I have a Vuex store object which has a mutation.

SET_FILTERS_CATEGORIES(state, payload) {
    state.filters.categories = payload;
},

//This "works"
SET_FILTERS_CATEGORIES(state, payload) {
    // state.filters.categories = payload;
},

If I commented this line it “works”. I dont understand what is the problem. It is inside the mutation section.

How does your state structure look like?
Is .filters maybe a store module?

This is the screenshot of the state from Vue debugger.

I assume it doesn’t like that you adjust the object that is referenced under “filters”.
This might work:

SET_FILTERS_CATEGORIES(state, payload) {
    state.filters = {
      ...state.filters,
      categories: payload
    }
},