Mintplex-Labs/anything-llm · error · Error

res.error || "Failed to toggle flow"

Error message

res.error || "Failed to toggle flow"

What it means

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.

Solutions

  1. Verify the flow id is valid.
  2. Check that the flow is in a state that allows toggling.
  3. Review the server error response.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown when toggling an agent flow enabled state fails.

Common situations: Invalid flow id or server-side state conflict.


AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18). Data as JSON: /api/errors/ab9451143aa6e7ad. Report an issue: GitHub.

Appendix: source

Thrown at frontend/src/models/agentFlows.js:137

  /**
   * Toggle a flow's active status
   * @param {string} uuid - The UUID of the flow to toggle
   * @param {boolean} active - The new active status
   * @returns {Promise<{success: boolean, error: string | null}>}
   */
  toggleFlow: async (uuid, active) => {
    try {
      const result = await fetch(`${API_BASE}/agent-flows/${uuid}/toggle`, {
        method: "POST",
        headers: {
          ...baseHeaders(),
          "Content-Type": "application/json",
        },
        body: JSON.stringify({ active }),
      })
        .then((res) => {
          if (!res.ok) throw new Error(res.error || "Failed to toggle flow");
          return res;
        })
        .then((res) => res.json());
      return { success: true, flow: result.flow };
    } catch (error) {
      console.error("Failed to toggle flow:", error);
      return { success: false, error: error.message };
    }
  },
};

export default AgentFlows;

View on GitHub (pinned to 3aec848f28)