n8n-io/n8n · error · TypeORMError

Found unknown node. Make sure to provided all involved nodes

Error message

Found unknown node. Make sure to provided all involved nodes. Unknown node: ${JSON.stringify(node)}

What it means

The same DFS in `SubjectTopoligicalSorter` asserts that every node referenced by an edge was registered in the node set (`uniqueNodes(edges)`). If an edge names a subject that was not included, the sorter throws `Found unknown node`, indicating the dependency list is internally inconsistent. This is an invariant violation rather than a user mapping error.

Source

Thrown at packages/@n8n/typeorm/src/persistence/SubjectTopoligicalSorter.ts:181

		}

		const nodes = uniqueNodes(edges);
		let cursor = nodes.length,
			sorted = new Array(cursor),
			visited: any = {},
			i = cursor;

		while (i--) {
			if (!visited[i]) visit(nodes[i], i, []);
		}

		function visit(node: any, i: number, predecessors: any[]) {
			if (predecessors.indexOf(node) >= 0) {
				throw new TypeORMError('Cyclic dependency: ' + JSON.stringify(node)); // todo: better error
			}

			if (!~nodes.indexOf(node)) {
				throw new TypeORMError(
					'Found unknown node. Make sure to provided all involved nodes. Unknown node: ' +
						JSON.stringify(node),
				);
			}

			if (visited[i]) return;
			visited[i] = true;

			// outgoing edges
			let outgoing = edges.filter(function (edge) {
				return edge[0] === node;
			});
			if ((i = outgoing.length)) {
				let preds = predecessors.concat(node);
				do {
					let child = outgoing[--i][1];
					visit(child, nodes.indexOf(child), preds);
				} while (i);

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Simplify the relation graph being persisted in one flush; save entities individually to isolate which relation triggers it.
  2. Disable suspect cascade options (especially 'cascade' on tree/self-ref relations) and re-add incrementally.
  3. If the graph is correct, capture the failing edge set and report upstream — this path is an internal-consistency guard.
Defensive patterns

Strategy: try-catch

Try / catch

try { await unitOfWork.execute(); } catch (e) { if (e instanceof TypeORMError && /Found unknown node/) { /* reduce the relation graph / disable suspect cascades and retry */ } throw e; }

Prevention

When it happens

Trigger: A subject's dependency list references another entity that was not added to the subjects being sorted. Typically reached through a bug in cascade wiring, a custom subscriber mutating the subject collection, or a partially-built subject graph during tree operations.

Common situations: A non-null relation points at an entity that was never instantiated as a subject (e.g. referenced only by id). Mixing raw `manager.update`/query results into a unit of work that then runs the sorter. Upgrading typeorm and hitting a regression in cascade subject building.

Related errors


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