Mintplex-Labs/anything-llm · warning · Error
Flow ${uuid} not found
Error message
Flow ${uuid} not found What it means
Thrown by AgentFlows.deleteFlow() when no file exists at STORAGE_DIR/plugins/agent-flows/{uuid}.json, or the resolved path is not within the flows directory. It is caught inside deleteFlow and returned as { success:false, error } so the caller sees a structured failure, not an exception.
Source
Thrown at server/utils/agentFlows/index.js:161
}));
} catch (error) {
console.error("Failed to list flows:", error);
return [];
}
}
/**
* Delete a flow by UUID
* @param {string} uuid - The UUID of the flow to delete
* @returns {Object} Result of the delete operation
*/
static deleteFlow(uuid) {
try {
const filePath = normalizePath(
path.join(AgentFlows.flowsDir, `${uuid}.json`)
);
if (!fs.existsSync(filePath) || !isWithin(AgentFlows.flowsDir, filePath))
throw new Error(`Flow ${uuid} not found`);
fs.rmSync(filePath);
return { success: true };
} catch (error) {
console.error("Failed to delete flow:", error);
return { success: false, error: error.message };
}
}
/**
* Execute a flow by UUID
* @param {string} uuid - The UUID of the flow to execute
* @param {Object} variables - Initial variables for the flow
* @param {Object} aibitat - The aibitat instance from the agent handler
* @returns {Promise<Object>} Result of flow execution
*/
static async executeFlow(uuid, variables = {}, aibitat = null) {
const flow = AgentFlows.loadFlow(uuid);
if (!flow) throw new Error(`Flow ${uuid} not found`);View on GitHub (pinned to 526360e320)
Solutions
- Call AgentFlows.listFlows() to confirm the uuid still exists before deleting.
- Verify STORAGE_DIR is consistent with where the flow was created.
- Treat a not-found delete as a no-op success if idempotency is desired in the caller.
Defensive patterns
Strategy: validation
Validate before calling
function flowExists(uuid) {
return AgentFlows.loadFlow(uuid) !== null;
}
// guard before delete
if (!flowExists(uuid)) return { success: true }; // idempotent no-op Try / catch
const res = AgentFlows.deleteFlow(uuid);
if (!res.success && res.error.endsWith("not found")) {
// treat as already-deleted / idempotent success
} Prevention
- Call listFlows() to confirm a uuid exists before deleting.
- Treat deleteFlow on a missing uuid as an idempotent success in callers.
- Keep STORAGE_DIR stable so the flows directory does not move between operations.
When it happens
Trigger: Calling deleteFlow() with a uuid whose .json file was already removed, never existed, or lives outside the flows directory due to a path-traversal guard (isWithin) failing. STORAGE_DIR having changed between calls also produces this.
Common situations: Double-deleting a flow; passing a stale uuid from a cached UI list; STORAGE_DIR environment variable changed so the flows directory moved; the flow file was deleted manually on disk.
Related errors
- ${res.error || "Failed to save flow"}
- ${res.error || "Failed to get flow"}
- ${res.error || "Failed to delete flow"}
- ${res.error || "Failed to toggle flow"}
- ${response.error || "Failed to create agent flow"}
AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13).
Data as JSON: /api/errors/0d1654f6c57af5b9.
Report an issue: GitHub.