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
- Simplify the relation graph being persisted in one flush; save entities individually to isolate which relation triggers it.
- Disable suspect cascade options (especially 'cascade' on tree/self-ref relations) and re-add incrementally.
- 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
- Persist complex graphs in smaller, ordered batches to avoid the sorter entirely.
- Avoid mixing cascade-driven saves with manual manager updates in one flush.
- When you see this, simplify the unit of work and re-add relations one at a time.
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
- Internal error. Subject ${subject.metadata.targetName} must
- Cyclic dependency: ${JSON.stringify(node)}
- Cannot ${operation}, given value must be instance of entity
- Removed entity "${subject.metadata.name}" is also scheduled
- Cannot attach entity "${entityName}" to its parent. Please m
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/d8e00bedab69c024.
Report an issue: GitHub.