{"record":{"id":"243404266a364643","repo":"n8n-io/n8n","slug":"llm-does-not-support-bindtools-cannot-use-tools","errorCode":null,"errorMessage":"LLM does not support bindTools - cannot use tools for node discovery","messagePattern":"LLM does not support bindTools - cannot use tools for node discovery","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@n8n/ai-workflow-builder.ee/src/code-builder/handlers/chat-setup-handler.ts","lineNumber":219,"sourceCode":"\n\t\treturn generateWorkflowCode({\n\t\t\tworkflow: currentWorkflow,\n\t\t\texecutionSchema: payload.workflowContext?.executionSchema,\n\t\t\texecutionData: payload.workflowContext?.executionData,\n\t\t\texpressionValues: payload.workflowContext?.expressionValues,\n\t\t\tvaluesExcluded: payload.workflowContext?.valuesExcluded,\n\t\t\tpinnedNodes: payload.workflowContext?.pinnedNodes,\n\t\t});\n\t}\n\n\t/**\n\t * Bind tools to LLM\n\t *\n\t * @returns LLM with tools bound, typed for use with AgentIterationHandler\n\t */\n\tprivate bindToolsToLlm(textEditorEnabled: boolean, hasPlanOutput: boolean): LlmWithTools {\n\t\tif (!this.llm.bindTools) {\n\t\t\tthrow new Error('LLM does not support bindTools - cannot use tools for node discovery');\n\t\t}\n\n\t\t// When an approved plan is provided, exclude get_suggested_nodes\n\t\t// because the plan already contains curated node suggestions per step\n\t\tlet tools: Array<\n\t\t\t| StructuredToolInterface\n\t\t\t| typeof TEXT_EDITOR_TOOL\n\t\t\t| typeof VALIDATE_TOOL\n\t\t\t| typeof BATCH_STR_REPLACE_TOOL\n\t\t> = hasPlanOutput ? this.tools.filter((t) => t.name !== 'get_suggested_nodes') : this.tools;\n\n\t\tif (textEditorEnabled) {\n\t\t\ttools = [...tools, TEXT_EDITOR_TOOL, VALIDATE_TOOL, BATCH_STR_REPLACE_TOOL];\n\t\t}\n\n\t\treturn this.llm.bindTools(tools) as LlmWithTools;\n\t}\n","sourceCodeStart":201,"sourceCodeEnd":237,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/ai-workflow-builder.ee/src/code-builder/handlers/chat-setup-handler.ts#L201-L237","documentation":"A capability guard in bindToolsToLlm: the LLM instance injected into the chat setup handler has no bindTools method, so LangChain-style tool binding for node discovery is impossible with this model adapter. The error is thrown before any tool call is attempted — it fires at wiring time and indicates an incompatible or mock LLM was configured.","triggerScenarios":"Thrown at packages/@n8n/ai-workflow-builder.ee/src/code-builder/handlers/chat-setup-handler.ts:219 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Configure an LLM that implements LangChain's bindTools (e.g. ChatOpenAI, ChatAnthropic) instead of the current adapter","Wrap the raw model in a LangChain chat-model adapter that supports tool calling","If running tests, provide a mock LLM whose bindTools returns a tool-capable model"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","contentChangedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}