{"record":{"id":"ab9451143aa6e7ad","repo":"Mintplex-Labs/anything-llm","slug":"res-error-failed-to-toggle-flow","errorCode":null,"errorMessage":"res.error || \"Failed to toggle flow\"","messagePattern":"res\\.error \\|\\| \"Failed to toggle flow\"","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"frontend/src/models/agentFlows.js","lineNumber":137,"sourceCode":"\n  /**\n   * Toggle a flow's active status\n   * @param {string} uuid - The UUID of the flow to toggle\n   * @param {boolean} active - The new active status\n   * @returns {Promise<{success: boolean, error: string | null}>}\n   */\n  toggleFlow: async (uuid, active) => {\n    try {\n      const result = await fetch(`${API_BASE}/agent-flows/${uuid}/toggle`, {\n        method: \"POST\",\n        headers: {\n          ...baseHeaders(),\n          \"Content-Type\": \"application/json\",\n        },\n        body: JSON.stringify({ active }),\n      })\n        .then((res) => {\n          if (!res.ok) throw new Error(res.error || \"Failed to toggle flow\");\n          return res;\n        })\n        .then((res) => res.json());\n      return { success: true, flow: result.flow };\n    } catch (error) {\n      console.error(\"Failed to toggle flow:\", error);\n      return { success: false, error: error.message };\n    }\n  },\n};\n\nexport default AgentFlows;\n","sourceCodeStart":119,"sourceCodeEnd":150,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/frontend/src/models/agentFlows.js#L119-L150","documentation":"Frontend guard in AgentFlows.toggleFlow: the POST to flip a flow's active status returned a non-ok status, so the toggle was not applied; the server's error message is used when the response includes one, else the generic 'Failed to toggle flow' text.","triggerScenarios":"Thrown when toggling an agent flow enabled state fails.","commonSituations":"Invalid flow id or server-side state conflict.","solutions":["Verify the flow id is valid.","Check that the flow is in a state that allows toggling.","Review the server error response."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3aec848f2885144aa8f1e53b9731a04310d5d558","analyzedAt":"2026-08-18T10:02:21.017Z","contentChangedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}