{"record":{"id":"91d8c666da0cf378","repo":"n8n-io/n8n","slug":"tool-toolname-was-called-but-not-found-among","errorCode":null,"errorMessage":"Tool \"${toolName}\" was called but not found among connected tools","messagePattern":"Tool \"(.+?)\" was called but not found among connected tools","errorType":"exception","errorClass":"NodeOperationError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/nodes-langchain/nodes/vendors/AlibabaCloud/actions/text/message.operation.ts","lineNumber":463,"sourceCode":"\n\tfor (const toolCall of toolCalls) {\n\t\tconst toolName = toolCall.function.name;\n\t\tlet toolInput: unknown;\n\t\ttry {\n\t\t\ttoolInput = JSON.parse(toolCall.function.arguments);\n\t\t} catch {\n\t\t\ttoolInput = toolCall.function.arguments;\n\t\t}\n\n\t\tlet toolResponse: unknown;\n\t\tfor (const connectedTool of connectedTools) {\n\t\t\tif (connectedTool.name === toolName) {\n\t\t\t\ttoolResponse = await connectedTool.invoke(toolInput);\n\t\t\t}\n\t\t}\n\n\t\tif (toolResponse === undefined) {\n\t\t\tthrow new NodeOperationError(\n\t\t\t\tthis.getNode(),\n\t\t\t\t`Tool \"${toolName}\" was called but not found among connected tools`,\n\t\t\t);\n\t\t}\n\n\t\tmessages.push({\n\t\t\trole: 'tool',\n\t\t\tcontent:\n\t\t\t\ttypeof toolResponse === 'object'\n\t\t\t\t\t? JSON.stringify(toolResponse)\n\t\t\t\t\t: String(toolResponse ?? ''),\n\t\t\tname: toolName,\n\t\t});\n\t}\n}\n","sourceCodeStart":445,"sourceCodeEnd":479,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/nodes-langchain/nodes/vendors/AlibabaCloud/actions/text/message.operation.ts#L445-L479","documentation":"Thrown during AlibabaCloud text/message tool-call processing when the LLM returns a function/tool call referencing a tool name that does not match any connected tool's name. The code iterates over connectedTools looking for a matching name; if none is found, toolResponse remains undefined and the error is thrown. This indicates a mismatch between what the model thinks is available and what the node actually has connected.","triggerScenarios":"The Alibaba Cloud Qwen model returns a tool_call with a function.name that doesn't match any connected LangChain tool's name. This happens when tools were connected/disconnected after the conversation context was established, when the model hallucinates a tool name, or when tool naming conventions differ between the model's training and the connected tools.","commonSituations":"A tool sub-node was removed or renamed after the workflow was last run; the model invents a tool name not in the actual tool list; tool names contain characters or casing that differs from what the model outputs; multiple tools with overlapping functionality cause the model to blend names.","solutions":["Check which tools are connected to the AlibabaCloud node and verify their names match what the model is calling.","Inspect the tool call in the execution data — the error message includes the exact toolName the model tried to call.","Re-add the missing tool sub-node or rename the connected tool to match the model's expectation.","Restart the conversation/workflow execution so the model receives an updated tool list."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Before processing tool calls, verify the called tool exists:\nconst connectedToolNames = connectedTools.map(t => t.name);\nfor (const toolCall of toolCalls ?? []) {\n  if (!connectedToolNames.includes(toolCall.function.name)) {\n    // log warning and skip, or provide a fallback response\n    messages.push({\n      role: 'tool',\n      content: `Tool '${toolCall.function.name}' is not available.`,\n      name: toolCall.function.name,\n    });\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  // ... tool call processing ...\n} catch (error) {\n  if (error instanceof NodeOperationError && error.message.includes('not found among connected tools')) {\n    // provide a graceful fallback to the model\n    messages.push({ role: 'tool', content: 'Tool not available, please use an alternative.', name: toolName });\n  } else {\n    throw error;\n  }\n}","preventionTips":["Ensure all tool sub-nodes are properly connected before executing the workflow.","Use stable, unique tool names that the model is unlikely to confuse with others.","Start each conversation/workflow run fresh so the model receives the current connected tool list.","Avoid disconnecting or renaming tools mid-conversation in interactive sessions."],"tags":["tool-call","llm","alibabacloud","langchain"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}