{"record":{"id":"7909938c7f981461","repo":"FlowiseAI/Flowise","slug":"cannot-call-the-same-agentflow-790993","errorCode":null,"errorMessage":"Cannot call the same agentflow!","messagePattern":"Cannot call the same agentflow!","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/sequentialagents/ExecuteFlow/ExecuteFlow.ts","lineNumber":186,"sourceCode":"        if (!sequentialNodes || !sequentialNodes.length) throw new Error('Execute Flow must have a predecessor!')\n\n        const baseURL = (nodeData.inputs?.baseURL as string) || (options.baseURL as string)\n        const returnValueAs = nodeData.inputs?.returnValueAs as string\n\n        // Validate selectedFlowId is a valid UUID\n        if (!selectedFlowId || !isValidUUID(selectedFlowId)) {\n            throw new Error('Invalid flow ID: must be a valid UUID')\n        }\n\n        // Validate baseURL is a valid URL\n        if (!baseURL || !isValidURL(baseURL)) {\n            throw new Error('Invalid base URL: must be a valid URL')\n        }\n\n        const credentialData = await getCredentialData(nodeData.credential ?? '', options)\n        const chatflowApiKey = getCredentialParam('chatflowApiKey', credentialData, nodeData)\n\n        if (selectedFlowId === options.chatflowid) throw new Error('Cannot call the same agentflow!')\n\n        let headers = {}\n        if (chatflowApiKey) headers = { Authorization: `Bearer ${chatflowApiKey}` }\n\n        const chatflowId = options.chatflowid\n        const sessionId = options.sessionId\n        const chatId = options.chatId\n\n        const executeFunc = async (state: ISeqAgentsState) => {\n            const variables = await getVars(appDataSource, databaseEntities, nodeData, options)\n\n            let flowInput = ''\n            if (seqExecuteFlowInput === 'userQuestion') {\n                flowInput = input\n            } else if (seqExecuteFlowInput && seqExecuteFlowInput.startsWith('{{') && seqExecuteFlowInput.endsWith('}}')) {\n                const nodeId = seqExecuteFlowInput.replace('{{', '').replace('}}', '').replace(/\\$/g, '').trim()\n                const messageOutputs = ((state.messages as unknown as BaseMessage[]) ?? []).filter(\n                    (message) => message.additional_kwargs && message.additional_kwargs?.nodeId === nodeId","sourceCodeStart":168,"sourceCodeEnd":204,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/sequentialagents/ExecuteFlow/ExecuteFlow.ts#L168-L204","documentation":"Self-recursion guard: if the Execute Flow node's selectedFlowId equals the host chatflow's own id (options.chatflowid), Flowise refuses the call because it would invoke itself indefinitely. Checked at init after UUID validation.","triggerScenarios":"The Execute Flow dropdown was set to the same chatflow that contains this node; a chatflow was cloned from a template that referenced the original by id.","commonSituations":"Cloning a flow that self-referenced the source; the flow list reordered and the wrong (current) item got selected; building a recursive pattern not knowing it is disallowed.","solutions":["Select a different target chatflow in the dropdown.","If iterative/self-referential logic is needed, use the Loop sequential node or split the work into a separate chatflow."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (selectedFlowId === options.chatflowid) {\n  throw new Error('Execute Flow cannot target its own chatflow (infinite recursion). Pick a different flow.')\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["After cloning a flow, re-check every Execute Flow target — the clone may still reference the original.","Use the Loop node for intentional iteration rather than self-call."],"tags":["execute-flow","recursion-guard","init"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}