{"record":{"id":"d8e00bedab69c024","repo":"n8n-io/n8n","slug":"found-unknown-node-make-sure-to-provided-all-invo","errorCode":null,"errorMessage":"Found unknown node. Make sure to provided all involved nodes. Unknown node: ${JSON.stringify(node)}","messagePattern":"Found unknown node\\. Make sure to provided all involved nodes\\. Unknown node: (.+?)","errorType":"exception","errorClass":"TypeORMError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/typeorm/src/persistence/SubjectTopoligicalSorter.ts","lineNumber":181,"sourceCode":"\t\t}\n\n\t\tconst nodes = uniqueNodes(edges);\n\t\tlet cursor = nodes.length,\n\t\t\tsorted = new Array(cursor),\n\t\t\tvisited: any = {},\n\t\t\ti = cursor;\n\n\t\twhile (i--) {\n\t\t\tif (!visited[i]) visit(nodes[i], i, []);\n\t\t}\n\n\t\tfunction visit(node: any, i: number, predecessors: any[]) {\n\t\t\tif (predecessors.indexOf(node) >= 0) {\n\t\t\t\tthrow new TypeORMError('Cyclic dependency: ' + JSON.stringify(node)); // todo: better error\n\t\t\t}\n\n\t\t\tif (!~nodes.indexOf(node)) {\n\t\t\t\tthrow new TypeORMError(\n\t\t\t\t\t'Found unknown node. Make sure to provided all involved nodes. Unknown node: ' +\n\t\t\t\t\t\tJSON.stringify(node),\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (visited[i]) return;\n\t\t\tvisited[i] = true;\n\n\t\t\t// outgoing edges\n\t\t\tlet outgoing = edges.filter(function (edge) {\n\t\t\t\treturn edge[0] === node;\n\t\t\t});\n\t\t\tif ((i = outgoing.length)) {\n\t\t\t\tlet preds = predecessors.concat(node);\n\t\t\t\tdo {\n\t\t\t\t\tlet child = outgoing[--i][1];\n\t\t\t\t\tvisit(child, nodes.indexOf(child), preds);\n\t\t\t\t} while (i);","sourceCodeStart":163,"sourceCodeEnd":199,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/typeorm/src/persistence/SubjectTopoligicalSorter.ts#L163-L199","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { await unitOfWork.execute(); } catch (e) { if (e instanceof TypeORMError && /Found unknown node/) { /* reduce the relation graph / disable suspect cascades and retry */ } throw e; }","preventionTips":["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."],"tags":["typeorm","persistence","topological-sort","internal","invariant"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}