{"record":{"id":"9b3782dd112bdb7c","repo":"n8n-io/n8n","slug":"conversational-agent-requires-chat-model","errorCode":null,"errorMessage":"Conversational Agent requires Chat Model","messagePattern":"Conversational Agent requires Chat Model","errorType":"exception","errorClass":"NodeOperationError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/nodes-langchain/nodes/agents/Agent/agents/ConversationalAgent/execute.ts","lineNumber":24,"sourceCode":"\nimport { isChatInstance } from '@n8n/ai-utilities';\nimport { getPromptInputByType, getConnectedTools } from '@utils/helpers';\nimport { wrapLangChainParserError } from '@utils/output_parsers/langchainParserError';\nimport { getOptionalOutputParser } from '@utils/output_parsers/N8nOutputParser';\nimport { throwIfToolSchema } from '@utils/schemaParsing';\nimport { buildTracingMetadata, getTracingConfig } from '@utils/tracing';\n\nimport { checkForStructuredTools, extractParsedOutput } from '../utils';\n\nexport async function conversationalAgentExecute(\n\tthis: IExecuteFunctions,\n\tnodeVersion: number,\n): Promise<INodeExecutionData[][]> {\n\tthis.logger.debug('Executing Conversational Agent');\n\tconst model = await this.getInputConnectionData(NodeConnectionTypes.AiLanguageModel, 0);\n\n\tif (!isChatInstance(model)) {\n\t\tthrow new NodeOperationError(this.getNode(), 'Conversational Agent requires Chat Model');\n\t}\n\n\tconst memory = (await this.getInputConnectionData(NodeConnectionTypes.AiMemory, 0)) as\n\t\t| BaseChatMemory\n\t\t| undefined;\n\n\tconst tools = await getConnectedTools(this, nodeVersion >= 1.5, true, true);\n\tconst outputParser = await getOptionalOutputParser(this);\n\n\tawait checkForStructuredTools(tools, this.getNode(), 'Conversational Agent');\n\n\t// TODO: Make it possible in the future to use values for other items than just 0\n\tconst options = this.getNodeParameter('options', 0, {}) as {\n\t\tsystemMessage?: string;\n\t\thumanMessage?: string;\n\t\tmaxIterations?: number;\n\t\treturnIntermediateSteps?: boolean;\n\t\ttracingMetadata?: { values?: Array<{ key: string; value: unknown }> };","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/nodes-langchain/nodes/agents/Agent/agents/ConversationalAgent/execute.ts#L6-L42","documentation":"Thrown by the Conversational Agent's execute function when the node resolved from the AiLanguageModel input connection is not a chat model instance (isChatInstance returns false). Conversational agents require a chat model because their prompt and memory flow is built around chat messages; a legacy completion model or non-model object is rejected up front.","triggerScenarios":"getInputConnectionData(NodeConnectionTypes.AiLanguageModel, 0) returns a model, then `if (!isChatInstance(model))` throws. Fires when a non-chat model (e.g. legacy text completion, embedding model) or an object that does not satisfy the chat-model interface is connected.","commonSituations":"Connecting a legacy completion model node instead of a Chat Model node; connecting an embeddings model; a custom model node whose class does not implement the chat-model contract; version mismatch where the connected node supplies a different shape.","solutions":["Connect a Chat Model node (e.g. OpenAI Chat Model, Anthropic Chat Model) to the AiLanguageModel input.","If using a custom model, ensure it extends BaseChatModel and passes isChatInstance.","Switch from the Conversational Agent to an agent type that supports the model you have, if a chat model is unavailable."],"exampleFix":"// before: AiLanguageModel input connected to 'OpenAI' (legacy completion) node\n// after: connect 'OpenAI Chat Model' node to the AiLanguageModel input","handlingStrategy":"type-guard","validationCode":"const model = await getInputConnectionData(NodeConnectionTypes.AiLanguageModel, 0);\nif (!isChatInstance(model)) throw new Error('Connect a Chat Model node');","typeGuard":"import { isChatInstance } from '...';\nfunction isChatModel(m): m is BaseChatModel { return isChatInstance(m); }","tryCatchPattern":null,"preventionTips":["Connect a Chat Model node (not legacy completion / embeddings) to Conversational Agent.","For custom models, extend BaseChatModel so isChatInstance passes.","Use the editor preview to confirm the resolved model is a chat instance."],"tags":["agent","conversational-agent","chat-model","langchain"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}