Mintplex-Labs/anything-llm · error
${res.error || "Failed to get flow"}
Error message
${res.error || "Failed to get flow"} What it means
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.
Source
Thrown at frontend/src/models/agentFlows.js:61
.catch((e) => ({
success: false,
error: e.message,
flows: [],
}));
},
/**
* Get a specific flow by UUID
* @param {string} uuid - The UUID of the flow to retrieve
* @returns {Promise<{success: boolean, error: string | null, flow: {name: string, config: object, uuid: string} | null}>}
*/
getFlow: async (uuid) => {
return await fetch(`${API_BASE}/agent-flows/${uuid}`, {
method: "GET",
headers: baseHeaders(),
})
.then((res) => {
if (!res.ok) throw new Error(res.error || "Failed to get flow");
return res;
})
.then((res) => res.json())
.catch((e) => ({
success: false,
error: e.message,
flow: null,
}));
},
/**
* Execute a specific flow
* @param {string} uuid - The UUID of the flow to run
* @param {object} variables - Optional variables to pass to the flow
* @returns {Promise<{success: boolean, error: string | null, results: object | null}>}
*/
// runFlow: async (uuid, variables = {}) => {
// return await fetch(`${API_BASE}/agent-flows/${uuid}/run`, {View on GitHub (pinned to 526360e320)
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.
Example fix
// before
.then((res) => {
if (!res.ok) throw new Error(res.error || 'Failed to get flow');
return res;
})
// after
.then(async (res) => {
const response = await res.json();
if (!res.ok) throw new Error(response?.error || `Failed to get flow (HTTP ${res.status})`);
return response;
}) Defensive patterns
Strategy: try-catch
Validate before calling
function assertUuid(uuid) {
if (!/^[0-9a-fA-F-]{36}$/.test(String(uuid || ''))) {
throw new Error('A valid flow UUID is required');
}
} Type guard
function isUuid(v) { return /^[0-9a-fA-F-]{36}$/.test(String(v || '')); } Try / catch
const { success, error, flow } = await AgentFlows.getFlow(uuid);
if (!success) {
if (/404|not found/i.test(error)) { navigate('/agent-flows'); return; }
showToast(error);
} Prevention
- 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.
When it happens
Trigger: Unknown/non-existent uuid (404), uuid of a flow belonging to another workspace (403/404), 401 session expired, 500 backend error.
Common situations: User opens a flow link whose uuid was deleted; deep link from a previous session; permissions changed.
Related errors
- ${res.error || "Failed to save flow"}
- ${res.error || "Failed to delete flow"}
- ${res.error || "Failed to toggle flow"}
- ${res.statusText || "Error fetching api keys."}
- ${res.statusText || "Error generating api key."}
AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13).
Data as JSON: /api/errors/20e98e30a9d50372.
Report an issue: GitHub.