n8n-io/n8n · error · NodeOperationError

Conversational Agent requires Chat Model

Error message

Conversational Agent requires Chat Model

What it means

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.

Source

Thrown at packages/@n8n/nodes-langchain/nodes/agents/Agent/agents/ConversationalAgent/execute.ts:24

import { isChatInstance } from '@n8n/ai-utilities';
import { getPromptInputByType, getConnectedTools } from '@utils/helpers';
import { wrapLangChainParserError } from '@utils/output_parsers/langchainParserError';
import { getOptionalOutputParser } from '@utils/output_parsers/N8nOutputParser';
import { throwIfToolSchema } from '@utils/schemaParsing';
import { buildTracingMetadata, getTracingConfig } from '@utils/tracing';

import { checkForStructuredTools, extractParsedOutput } from '../utils';

export async function conversationalAgentExecute(
	this: IExecuteFunctions,
	nodeVersion: number,
): Promise<INodeExecutionData[][]> {
	this.logger.debug('Executing Conversational Agent');
	const model = await this.getInputConnectionData(NodeConnectionTypes.AiLanguageModel, 0);

	if (!isChatInstance(model)) {
		throw new NodeOperationError(this.getNode(), 'Conversational Agent requires Chat Model');
	}

	const memory = (await this.getInputConnectionData(NodeConnectionTypes.AiMemory, 0)) as
		| BaseChatMemory
		| undefined;

	const tools = await getConnectedTools(this, nodeVersion >= 1.5, true, true);
	const outputParser = await getOptionalOutputParser(this);

	await checkForStructuredTools(tools, this.getNode(), 'Conversational Agent');

	// TODO: Make it possible in the future to use values for other items than just 0
	const options = this.getNodeParameter('options', 0, {}) as {
		systemMessage?: string;
		humanMessage?: string;
		maxIterations?: number;
		returnIntermediateSteps?: boolean;
		tracingMetadata?: { values?: Array<{ key: string; value: unknown }> };

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Connect a Chat Model node (e.g. OpenAI Chat Model, Anthropic Chat Model) to the AiLanguageModel input.
  2. If using a custom model, ensure it extends BaseChatModel and passes isChatInstance.
  3. Switch from the Conversational Agent to an agent type that supports the model you have, if a chat model is unavailable.

Example fix

// before: AiLanguageModel input connected to 'OpenAI' (legacy completion) node
// after: connect 'OpenAI Chat Model' node to the AiLanguageModel input
Defensive patterns

Strategy: type-guard

Validate before calling

const model = await getInputConnectionData(NodeConnectionTypes.AiLanguageModel, 0);
if (!isChatInstance(model)) throw new Error('Connect a Chat Model node');

Type guard

import { isChatInstance } from '...';
function isChatModel(m): m is BaseChatModel { return isChatInstance(m); }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12). Data as JSON: /api/errors/9b3782dd112bdb7c. Report an issue: GitHub.