{"record":{"id":"6a18b8af55c153f4","repo":"FlowiseAI/Flowise","slug":"cannot-call-the-same-chatflow","errorCode":null,"errorMessage":"Cannot call the same chatflow!","messagePattern":"Cannot call the same chatflow!","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/tools/ChatflowTool/ChatflowTool.ts","lineNumber":191,"sourceCode":"\n        const startNewSession = nodeData.inputs?.startNewSession as boolean\n\n        const baseURL = (nodeData.inputs?.baseURL as string) || (options.baseURL as string)\n\n        // Validate selectedChatflowId is a valid UUID\n        if (!selectedChatflowId || !isValidUUID(selectedChatflowId)) {\n            throw new Error('Invalid chatflow 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 (selectedChatflowId === options.chatflowid) throw new Error('Cannot call the same chatflow!')\n\n        let headers = {}\n        if (chatflowApiKey) headers = { Authorization: `Bearer ${chatflowApiKey}` }\n\n        let toolInput = ''\n        if (useQuestionFromChat) {\n            toolInput = input\n        } else if (customInput) {\n            toolInput = customInput\n        }\n\n        let name = _name || 'chatflow_tool'\n\n        return new ChatflowTool({\n            name,\n            baseURL,\n            description,\n            returnDirect,","sourceCodeStart":173,"sourceCodeEnd":209,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/tools/ChatflowTool/ChatflowTool.ts#L173-L209","documentation":"Thrown when selectedChatflowId equals options.chatflowid — the chatflow-as-tool would invoke the very chatflow currently running. Same recursion guard as error 346 for the agentflow variant: prevents an infinite HTTP self-call loop.","triggerScenarios":"A ChatflowTool node pointed at its own chatflow id; dynamic config that resolves to the host id; flow duplicated as a template without retargeting.","commonSituations":"Building an orchestrator chatflow that mistakenly lists itself; copy-paste of tool config across flows without updating the target.","solutions":["Select a different chatflow as the tool target.","If self-invocation is truly needed, call the internal logic directly instead of via HTTP.","Filter the dropdown so the host flow's own id is not selectable."],"exampleFix":"// before\nif (selectedChatflowId === options.chatflowid) throw new Error('Cannot call the same chatflow!')\n// after\nif (selectedChatflowId === options.chatflowid) {\n  throw new Error(`Cannot call the same chatflow (id=${selectedChatflowId}). Pick a different target chatflow.`)\n}","handlingStrategy":"validation","validationCode":"function assertNotSelfCallChatflow(targetId: string, hostId: string | undefined) {\n  if (targetId === hostId) {\n    throw new Error(`Cannot call the same chatflow (id=${targetId}). Pick a different target.`)\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Filter the dropdown so the host chatflow's own id is not selectable.","When duplicating flows, re-target self-referential tool nodes immediately.","Maintain a denylist of 'self' ids for orchestrator patterns."],"tags":["recursion","validation","runtime","chatflow","guard"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}