Mintplex-Labs/anything-llm · warning
Flow not found
Error message
Flow not found
What it means
GET /agent-flows/:uuid returns this 404 when AgentFlows.loadFlow returns null. loadFlow (server/utils/agentFlows/index.js:69) returns null when the uuid is falsy, when <flowsDir>/<uuid>.json does not exist, when the resolved path escapes the flows directory, or when the file exists but does not parse as JSON (safeJsonParse yields null).
Source
Thrown at server/endpoints/agentFlows.js:83
console.error("Error listing flows:", error);
return response.status(500).json({
success: false,
error: error.message,
});
}
}
);
// Get a specific flow by UUID
app.get(
"/agent-flows/:uuid",
[validatedRequest, flexUserRoleValid([ROLES.admin])],
async (request, response) => {
try {
const { uuid } = request.params;
const flow = AgentFlows.loadFlow(uuid);
if (!flow) {
return response.status(404).json({
success: false,
error: "Flow not found",
});
}
return response.status(200).json({
success: true,
flow,
});
} catch (error) {
console.error("Error getting flow:", error);
return response.status(500).json({
success: false,
error: error.message,
});
}
}
);View on GitHub (pinned to 3aec848f28)
Solutions
- Call GET /agent-flows/list first and confirm the uuid still exists; refresh the flow list in the UI
- If the file was expected, check storage/plugins/agent-flows/<uuid>.json on disk and validate it parses as JSON
- Ensure STORAGE_DIR is consistent across restarts/deployments so previously saved flows are found
Defensive patterns
Strategy: validation
Validate before calling
async function flowExists(uuid) {
const res = await fetch('/api/agent-flows/list');
const { flows } = await res.json();
return flows.some(f => f.uuid === uuid);
} Type guard
const UUID_V4_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
function isFlowUuid(v) {
return typeof v === 'string' && UUID_V4_RE.test(v) && !v.includes('..');
} Prevention
- Validate uuid format client-side before requesting a flow
- After any delete operation, purge that uuid from local caches/UI state
- Keep STORAGE_DIR stable across deployments so uuids remain resolvable
When it happens
Trigger: Requesting a flow uuid that was deleted; a copy-pasted/truncated uuid; a flow file renamed or removed on disk from storage/plugins/agent-flows; a corrupted flow file that fails JSON parsing; a uuid containing path segments ('../x') rejected by the isWithin check.
Common situations: Stale UI after another admin deleted the flow; docker volume where STORAGE_DIR changed between runs so old uuids no longer resolve; manual editing of flow files that broke JSON.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Flow ${uuid} not found
- Invalid session ID.
- API Call failed: ${error.message}
- Failed to publish agent flow: ${error.message}
- Invalid source property provided
AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18).
Data as JSON: /api/errors/5399b4c40b2427f7.
Report an issue: GitHub.