{"record":{"id":"f0365cc3cce8b655","repo":"chatwoot/chatwoot","slug":"error-f0365c","errorCode":null,"errorMessage":"error","messagePattern":"error","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"app/javascript/dashboard/store/modules/integrations.js","lineNumber":135,"sourceCode":"    commit(types.default.SET_INTEGRATIONS_UI_FLAG, { isCreatingHook: true });\n    try {\n      const response = await IntegrationsAPI.createHook(hookData);\n      commit(types.default.ADD_INTEGRATION_HOOKS, response.data);\n      commit(types.default.SET_INTEGRATIONS_UI_FLAG, { isCreatingHook: false });\n    } catch (error) {\n      commit(types.default.SET_INTEGRATIONS_UI_FLAG, { isCreatingHook: false });\n      throw error;\n    }\n  },\n  deleteHook: async ({ commit }, { appId, hookId }) => {\n    commit(types.default.SET_INTEGRATIONS_UI_FLAG, { isDeletingHook: true });\n    try {\n      await IntegrationsAPI.deleteHook(hookId);\n      commit(types.default.DELETE_INTEGRATION_HOOKS, { appId, hookId });\n      commit(types.default.SET_INTEGRATIONS_UI_FLAG, { isDeletingHook: false });\n    } catch (error) {\n      commit(types.default.SET_INTEGRATIONS_UI_FLAG, { isDeletingHook: false });\n      throw new Error(error);\n    }\n  },\n};\n\nexport const mutations = {\n  [types.default.SET_INTEGRATIONS_UI_FLAG]($state, uiFlag) {\n    $state.uiFlags = { ...$state.uiFlags, ...uiFlag };\n  },\n  [types.default.SET_INTEGRATIONS]: MutationHelpers.set,\n  [types.default.ADD_INTEGRATION]: MutationHelpers.updateAttributes,\n  [types.default.DELETE_INTEGRATION]: MutationHelpers.updateAttributes,\n  [types.default.ADD_INTEGRATION_HOOKS]: ($state, data) => {\n    $state.records = $state.records.map(record => {\n      if (record.id === data.app_id) {\n        return {\n          ...record,\n          hooks: [...record.hooks, data],\n        };","sourceCodeStart":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/chatwoot/chatwoot/blob/ed230f9bc068e7a13dd5c0404d5465a204b68d4c/app/javascript/dashboard/store/modules/integrations.js#L117-L153","documentation":"In the `deleteHook` action of the integrations store, a failed `IntegrationsAPI.deleteHook(hookId)` is re-wrapped as `throw new Error(error)` (the createHook action just above correctly does `throw error`). Coercion turns object rejections into '[object Object]' and flattens axios errors, discarding response, status and stack. The uiFlags reset is duplicated in both try and catch, which works but is fragile.","triggerScenarios":"Dispatching `integrations/deleteHook` when DELETE /integrations/hooks/:hookId returns 404 (hook already deleted in another tab), 401 (expired session), 403 (missing permission), or the request fails at network level.","commonSituations":"Stale integration settings page after the hook was removed elsewhere; token expiry mid-session; webhook-capability integrations (Slack/webhooks) being edited concurrently by two admins.","solutions":["Match the createHook pattern one screen above: `throw error;`","Or wrap with extraction: `throw new Error(error?.response?.data?.message || error?.message || 'Could not delete the hook');`","Catch the dispatch in the integration settings component and show the message.","Optionally move the uiFlags reset into a `finally` block to remove the duplicated commit."],"exampleFix":"// before\n} catch (error) {\n  commit(types.default.SET_INTEGRATIONS_UI_FLAG, { isDeletingHook: false });\n  throw new Error(error);\n}\n\n// after\n} catch (error) {\n  commit(types.default.SET_INTEGRATIONS_UI_FLAG, { isDeletingHook: false });\n  throw error;\n}","handlingStrategy":"try-catch","validationCode":"null","typeGuard":"null","tryCatchPattern":"try {\n  await this.$store.dispatch('integrations/deleteHook', { appId, hookId });\n} catch (error) {\n  const message = !error?.message || error.message === '[object Object]'\n    ? 'Could not delete the hook'\n    : error.message;\n  this.showAlert(message);\n}","preventionTips":["Match the createHook pattern and `throw error;`","Treat 404 as already-deleted in the integration settings UI","Move uiFlags resets into finally to keep flag handling single-sourced","Add failure-path specs for hook deletion"],"tags":["vuex","axios","chatwoot","integrations","webhooks","error-handling"],"backgroundTag":"object-object-error-message","analyzedSha":"ed230f9bc068e7a13dd5c0404d5465a204b68d4c","analyzedAt":"2026-08-21T12:45:25.920Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}