n8n-io/n8n · error

Agent node "${agentNodeName}" not found in workflow

Error message

Agent node "${agentNodeName}" not found in workflow

What it means

Error "Agent node "${agentNodeName}" not found in workflow" thrown in n8n-io/n8n.

Source

Thrown at packages/@n8n/instance-ai/src/tools/evals/detect-agent-named-refs.service.ts:37

	column: string;
	/** Which node has the parameter that references nodeName. Either the agent itself or a sub-component (memory, tool, ...). */
	targetNodeName: string;
}

function slug(name: string): string {
	const result = name
		.toLowerCase()
		.replace(/[^a-z0-9]+/g, '_')
		.replace(/^_+|_+$/g, '');
	return result.length > 0 ? result : 'node';
}

type RawMatch = NamedRefMatch;

export function detectAgentNamedRefs(workflow: WorkflowJSON, agentNodeName: string): NamedRef[] {
	const node = (workflow.nodes ?? []).find((n) => nodeHasName(n) && n.name === agentNodeName);
	if (!node) {
		throw new Error(`Agent node "${agentNodeName}" not found in workflow`);
	}

	const targets = [agentNodeName, ...findAgentSubComponents(workflow, agentNodeName)];
	const nodesByName = new Map(
		(workflow.nodes ?? []).filter(nodeHasName).map((n) => [n.name, n] as const),
	);

	// First pass: collect, per target, the de-duplicated set of (source, field) raw matches.
	const targetMatches = new Map<string, RawMatch[]>();
	for (const target of targets) {
		const tNode = nodesByName.get(target);
		if (!tNode) continue;
		const matches = collectStrings(tNode.parameters).flatMap((text) =>
			extractNamedRefMatches(text),
		);
		const dedup = new Map<string, RawMatch>();
		for (const m of matches) {
			const key = `${m.nodeName}\x00${m.field}`;

View on GitHub (pinned to 5ac6606e81)

When it happens

Trigger: Thrown at packages/@n8n/instance-ai/src/tools/evals/detect-agent-named-refs.service.ts:37 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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