{"record":{"id":"3f9ca766c0b834a4","repo":"Mintplex-Labs/anything-llm","slug":"res-error-failed-to-save-flow","errorCode":null,"errorMessage":"res.error || \"Failed to save flow\"","messagePattern":"res\\.error \\|\\| \"Failed to save flow\"","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"frontend/src/models/agentFlows.js","lineNumber":22,"sourceCode":"const AgentFlows = {\n  /**\n   * Save a flow configuration\n   * @param {string} name - Display name of the flow\n   * @param {object} config - The configuration object for the flow\n   * @param {string} [uuid] - Optional UUID for updating existing flow\n   * @returns {Promise<{success: boolean, error: string | null, flow: {name: string, config: object, uuid: string} | null}>}\n   */\n  saveFlow: async (name, config, uuid = null) => {\n    return await fetch(`${API_BASE}/agent-flows/save`, {\n      method: \"POST\",\n      headers: {\n        ...baseHeaders(),\n        \"Content-Type\": \"application/json\",\n      },\n      body: JSON.stringify({ name, config, uuid }),\n    })\n      .then((res) => {\n        if (!res.ok) throw new Error(res.error || \"Failed to save flow\");\n        return res;\n      })\n      .then((res) => res.json())\n      .catch((e) => ({\n        success: false,\n        error: e.message,\n        flow: null,\n      }));\n  },\n\n  /**\n   * List all available flows in the system\n   * @returns {Promise<{success: boolean, error: string | null, flows: Array<{name: string, uuid: string, description: string, steps: Array}>}>}\n   */\n  listFlows: async () => {\n    return await fetch(`${API_BASE}/agent-flows/list`, {\n      method: \"GET\",\n      headers: baseHeaders(),","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/frontend/src/models/agentFlows.js#L4-L40","documentation":"Frontend guard in AgentFlows.saveFlow: the POST to /agent-flows/save returned a non-ok HTTP status, meaning the backend rejected the flow save (e.g. validation failure or server error); the server-provided error is used when present, otherwise the generic 'Failed to save flow' text.","triggerScenarios":"Thrown when the agent flow save API call returns an error.","commonSituations":"Invalid flow definition, missing required fields, or server-side validation failure.","solutions":["Check the server response error for details and correct the flow definition.","Verify the flow JSON schema and required fields before saving.","Retry after fixing validation errors reported by the server."],"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"}