{"record":{"id":"92e64009b89972d3","repo":"n8n-io/n8n","slug":"splitinbatches-node-connections-are-managed-by-spl","errorCode":null,"errorMessage":"SplitInBatches node connections are managed by SplitInBatchesBuilder","messagePattern":"SplitInBatches node connections are managed by SplitInBatchesBuilder","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@n8n/workflow-sdk/src/workflow-builder/control-flow-builders/split-in-batches.ts","lineNumber":67,"sourceCode":"\t\t\t\t...this.config,\n\t\t\t\t...config,\n\t\t\t},\n\t\t});\n\t}\n\n\tinput(_index: number): InputTarget {\n\t\tthrow new Error('SplitInBatches node input connections are managed by SplitInBatchesBuilder');\n\t}\n\n\toutput(_index: number): OutputSelector<'n8n-nodes-base.splitInBatches', string, unknown> {\n\t\tthrow new Error('SplitInBatches node output connections are managed by SplitInBatchesBuilder');\n\t}\n\n\tto<T extends NodeInstance<string, string, unknown>>(\n\t\t_target: T | T[] | InputTarget,\n\t\t_outputIndex?: number,\n\t): NodeChain<NodeInstance<'n8n-nodes-base.splitInBatches', string, unknown>, T> {\n\t\tthrow new Error('SplitInBatches node connections are managed by SplitInBatchesBuilder');\n\t}\n\n\tonError<T extends NodeInstance<string, string, unknown>>(_handler: T): this {\n\t\tthrow new Error('SplitInBatches node error handling is managed by SplitInBatchesBuilder');\n\t}\n\n\tgetConnections(): DeclaredConnection[] {\n\t\treturn [];\n\t}\n}\n\n/**\n * A batch of nodes - either a single node or an array of nodes for fan-out\n */\nexport type NodeBatch =\n\t| NodeInstance<string, string, unknown>\n\t| Array<NodeInstance<string, string, unknown>>;\n","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/workflow-sdk/src/workflow-builder/control-flow-builders/split-in-batches.ts#L49-L85","documentation":"Thrown by SplitInBatchesNodeInstance.to(). The .to() method is the standard fan-out wiring entry point on NodeInstance, but SplitInBatches loop wiring must be declared through SplitInBatchesBuilder so that the loop-back edge is generated correctly. Calling .to() directly is rejected to prevent half-declared loops.","triggerScenarios":"Calling sibNode.to(target) or sibNode.to([a, b]); fluent code that chains source.to(sib).to(after) without going through the builder.","commonSituations":"Placing a SplitInBatches node mid-chain via .to(); assuming the standard .to() semantics apply to loop nodes.","solutions":["Declare each/done branches in the splitInBatches() factory or via the fluent builder's .onEachBatch()/.onDone().","Route into the SIB through the builder rather than calling .to() on the node.","Use the builder's getAllNodes()/getConnections() to obtain declared edges."],"exampleFix":"// before\nsource.to(sibNode).to(processNode);\n// after\nconst sib = splitInBatches('sib', { each: processNode, done: endNode });\nworkflow(source, sib);","handlingStrategy":"type-guard","validationCode":"function safeTo<T extends NodeInstance<any, any, any>>(src: NodeInstance, target: T): NodeChain<any, T> {\n  if (src.type === 'n8n-nodes-base.splitInBatches') {\n    throw new Error('SplitInBatches .to() is managed by the builder');\n  }\n  return src.to(target);\n}","typeGuard":"function isSplitInBatches(node: NodeInstance): node is NodeInstance<'n8n-nodes-base.splitInBatches', string, unknown> {\n  return node.type === 'n8n-nodes-base.splitInBatches';\n}","tryCatchPattern":null,"preventionTips":["Do not place a SplitInBatches node mid-chain via .to(); use the builder to declare each/done branches.","Route into the SIB through the builder, not by calling .to() on the node.","In generic chaining utilities, skip SplitInBatches nodes."],"tags":["runtime","builder","split-in-batches","connections"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}