{"record":{"id":"d270996cceb68a8b","repo":"vuejs/vuex","slug":"vuex-error-in-error-action-subscribers","errorCode":null,"errorMessage":"[vuex] error in error action subscribers: ","messagePattern":"\\[vuex\\] error in error action subscribers: ","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/store.js","lineNumber":190,"sourceCode":"        try {\n          this._actionSubscribers\n            .filter(sub => sub.after)\n            .forEach(sub => sub.after(action, this.state))\n        } catch (e) {\n          if (__DEV__) {\n            console.warn(`[vuex] error in after action subscribers: `)\n            console.error(e)\n          }\n        }\n        resolve(res)\n      }, error => {\n        try {\n          this._actionSubscribers\n            .filter(sub => sub.error)\n            .forEach(sub => sub.error(action, this.state, error))\n        } catch (e) {\n          if (__DEV__) {\n            console.warn(`[vuex] error in error action subscribers: `)\n            console.error(e)\n          }\n        }\n        reject(error)\n      })\n    })\n  }\n\n  subscribe (fn, options) {\n    return genericSubscribe(fn, this._subscribers, options)\n  }\n\n  subscribeAction (fn, options) {\n    const subs = typeof fn === 'function' ? { before: fn } : fn\n    return genericSubscribe(subs, this._actionSubscribers, options)\n  }\n\n  watch (getter, cb, options) {","sourceCodeStart":172,"sourceCodeEnd":208,"githubUrl":"https://github.com/vuejs/vuex/blob/bd907467b8392d6671bb115738285ff7f63d0cf6/src/store.js#L172-L208","documentation":"An error subscriber (subscribeAction error handler, Vuex 3.6+) threw while processing a failed action. Vuex catches it so the original action rejection is still propagated, logging a dev warning and the subscriber error.","triggerScenarios":"subscribeAction({ error(action, state, error) { ... } }) throwing when an action rejects — e.g. assuming error.response exists on network errors, or non-Error rejection values.","commonSituations":"Axios error handling in the subscriber assuming a response object; error reporter plugins choking on string rejections; handlers written before the error-hook existed receiving unexpected arguments.","solutions":["Guard against arbitrary rejection values (typeof error === 'object', optional chaining on error.response)","Fix the handler per the logged console.error(e)","Wrap handler body in try/catch so error reporting never throws","Confirm all three subscriber hooks use (action, state, error) signatures"],"exampleFix":"// before\nsubscribeAction: { error: (action, state, error) => report(error.response.status) }\n// after\nsubscribeAction: { error: (action, state, error) => report(error && error.response ? error.response.status : error) }","handlingStrategy":"try-catch","validationCode":"function safeErrorSubscriber(fn) {\n  return (action, state, error) => { try { fn(action, state, error) } catch (e) { console.warn('error subscriber failed', e) } }\n}\n// register: subscribeAction({ error: safeErrorSubscriber(report) })","typeGuard":"function isHttpError(e) {\n  return e instanceof Error && 'response' in e && typeof e.response?.status === 'number'\n}","tryCatchPattern":"store.subscribeAction({\n  error(action, state, error) {\n    try {\n      const status = error?.response?.status ?? 'unknown'\n      report(action.type, status)\n    } catch (e) { console.warn('[vuex] error reporter failed', e) }\n  }\n})","preventionTips":["Treat rejection values as unknown (can be strings/objects, not always Error)","Guard HTTP-specific fields (error.response) with optional chaining","Never let the error reporter itself throw — it masks the real failure","Keep error subscriber signature (action, state, error) per Vuex 3.6+ docs"],"tags":["vuex","plugin","action-subscriber","error-handling"],"backgroundTag":"plugin-subscriber-crash","analyzedSha":"bd907467b8392d6671bb115738285ff7f63d0cf6","analyzedAt":"2026-08-28T21:38:57.320Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}