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-tool-refs.service.ts:60

	}
	return reached;
}

/**
 * Detects named cross-node references inside the AI agent's sub-components
 * (tools, memory, output parsers — anything wired in via `ai_*`). Filters
 * out refs that:
 *   - point to nodes not present in the workflow,
 *   - point to the agent itself,
 *   - point to nodes downstream of the agent (those execute during eval).
 *
 * Each remaining ref names a node whose data must be supplied via `pinData`
 * for eval runs to see realistic context.
 */
export function detectToolRefs(workflow: WorkflowJSON, agentNodeName: string): ToolRef[] {
	const agent = (workflow.nodes ?? []).find((n) => nodeHasName(n) && n.name === agentNodeName);
	if (!agent) {
		throw new Error(`Agent node "${agentNodeName}" not found in workflow`);
	}

	const subComponents = findAgentSubComponents(workflow, agentNodeName);
	if (subComponents.length === 0) return [];

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

	const seen = new Set<string>();
	const result: ToolRef[] = [];
	for (const toolNodeName of subComponents) {
		const toolNode = nodesByName.get(toolNodeName);
		if (!toolNode) continue;
		const matches = collectStrings(toolNode.parameters).flatMap((text) =>
			extractNamedRefMatches(text),
		);

View on GitHub (pinned to 5ac6606e81)

When it happens

Trigger: Thrown at packages/@n8n/instance-ai/src/tools/evals/detect-tool-refs.service.ts:60 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/032ec4dd0a98c886. Report an issue: GitHub.