{"record":{"id":"20e98e30a9d50372","repo":"Mintplex-Labs/anything-llm","slug":"res-error-failed-to-get-flow","errorCode":null,"errorMessage":"${res.error || \"Failed to get flow\"}","messagePattern":"\\$\\{res\\.error \\|\\| \"Failed to get flow\"\\}","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src/models/agentFlows.js","lineNumber":61,"sourceCode":"      .catch((e) => ({\n        success: false,\n        error: e.message,\n        flows: [],\n      }));\n  },\n\n  /**\n   * Get a specific flow by UUID\n   * @param {string} uuid - The UUID of the flow to retrieve\n   * @returns {Promise<{success: boolean, error: string | null, flow: {name: string, config: object, uuid: string} | null}>}\n   */\n  getFlow: async (uuid) => {\n    return await fetch(`${API_BASE}/agent-flows/${uuid}`, {\n      method: \"GET\",\n      headers: baseHeaders(),\n    })\n      .then((res) => {\n        if (!res.ok) throw new Error(res.error || \"Failed to get 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   * Execute a specific flow\n   * @param {string} uuid - The UUID of the flow to run\n   * @param {object} variables - Optional variables to pass to the flow\n   * @returns {Promise<{success: boolean, error: string | null, results: object | null}>}\n   */\n  // runFlow: async (uuid, variables = {}) => {\n  //   return await fetch(`${API_BASE}/agent-flows/${uuid}/run`, {","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/526360e320da9d1b36074be5ed64fe76e5bbfbbd/frontend/src/models/agentFlows.js#L43-L79","documentation":"Thrown from `getFlow` on a non-ok `GET /api/agent-flows/:uuid`. Same defect as 51: `res.error` on a `Response` is always `undefined`, so the message is always the literal 'Failed to get flow' regardless of the server's response body.","triggerScenarios":"Unknown/non-existent uuid (404), uuid of a flow belonging to another workspace (403/404), 401 session expired, 500 backend error.","commonSituations":"User opens a flow link whose uuid was deleted; deep link from a previous session; permissions changed.","solutions":["Patch to read `await res.json()` then `response.error` (see exampleFix for 51).","Inspect the network response body for the true cause during debugging.","Handle 404 by showing 'flow not found' and 401 by re-authenticating.","Confirm the uuid is well-formed and belongs to the current workspace."],"exampleFix":"// before\n.then((res) => {\n  if (!res.ok) throw new Error(res.error || 'Failed to get flow');\n  return res;\n})\n\n// after\n.then(async (res) => {\n  const response = await res.json();\n  if (!res.ok) throw new Error(response?.error || `Failed to get flow (HTTP ${res.status})`);\n  return response;\n})","handlingStrategy":"try-catch","validationCode":"function assertUuid(uuid) {\n  if (!/^[0-9a-fA-F-]{36}$/.test(String(uuid || ''))) {\n    throw new Error('A valid flow UUID is required');\n  }\n}","typeGuard":"function isUuid(v) { return /^[0-9a-fA-F-]{36}$/.test(String(v || '')); }","tryCatchPattern":"const { success, error, flow } = await AgentFlows.getFlow(uuid);\nif (!success) {\n  if (/404|not found/i.test(error)) { navigate('/agent-flows'); return; }\n  showToast(error);\n}","preventionTips":["Patch the model to read `response.error` from the JSON body.","Confirm the uuid belongs to the current workspace.","Handle 404 by refreshing the flow list."],"tags":["frontend","agent-flows","fetch","bug","network"],"backgroundTag":null,"analyzedSha":"526360e320da9d1b36074be5ed64fe76e5bbfbbd","analyzedAt":"2026-08-13T01:45:47.170Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}