{"record":{"id":"abec416de3f61667","repo":"n8n-io/n8n","slug":"splitinbatches-node-input-connections-are-managed","errorCode":null,"errorMessage":"SplitInBatches node input connections are managed by SplitInBatchesBuilder","messagePattern":"SplitInBatches node input 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":56,"sourceCode":"\t\t\t...config,\n\t\t\tparameters: config.parameters,\n\t\t};\n\t}\n\n\tupdate(\n\t\tconfig: Partial<NodeConfig>,\n\t): NodeInstance<'n8n-nodes-base.splitInBatches', string, unknown> {\n\t\treturn new SplitInBatchesNodeInstance({\n\t\t\tversion: this.version,\n\t\t\tconfig: {\n\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[] {","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/workflow-sdk/src/workflow-builder/control-flow-builders/split-in-batches.ts#L38-L74","documentation":"Thrown by SplitInBatchesNodeInstance.input(). SplitInBatches is a loop node whose input wiring must be set up through SplitInBatchesBuilder, which owns the loop-back connection. Calling .input() directly on the node would bypass that ownership and produce invalid loop wiring, so every connection entry point on the raw node throws.","triggerScenarios":"Calling sibNode.input(0) directly; generic node-walking code that iterates an array of nodes and unconditionally calls .input()/.output() without special-casing SplitInBatches.","commonSituations":"Writing a generic layout or connection utility that assumes all NodeInstance objects expose the same connection API; holding a reference to the inner SIB node instead of the builder.","solutions":["Create the node via the splitInBatches() factory and configure input through the builder's branches (each/done).","Do not call .input() on a SplitInBatches node; obtain the builder and let it manage wiring.","Type-narrow (isSplitInBatchesType) before calling generic connection helpers."],"exampleFix":"// before\nconst sib = splitInBatches('sib', {});\nsource.to(sib.sibNode.input(0));\n// after\nsplitInBatches('sib', { each: processNode, done: endNode }); // builder wires the input","handlingStrategy":"type-guard","validationCode":"import { isSplitInBatchesType } from '@n8n/workflow-sdk/constants/node-types';\n\nfunction safeInput(node: NodeInstance): InputTarget {\n  if (isSplitInBatchesType(node.type)) {\n    throw new Error('Use the SplitInBatchesBuilder to wire this node, not .input()');\n  }\n  return node.input(0);\n}","typeGuard":"function isConnectionManagedNode(node: NodeInstance): boolean {\n  return node.type === 'n8n-nodes-base.splitInBatches';\n}","tryCatchPattern":"try {\n  return node.input(index);\n} catch (e) {\n  if (e instanceof Error && /managed by SplitInBatchesBuilder/.test(e.message)) {\n    // route through the builder instead\n  }\n  throw e;\n}","preventionTips":["Always construct SplitInBatches via the splitInBatches() factory and use the builder for wiring.","In generic node-walking utilities, skip nodes whose type is n8n-nodes-base.splitInBatches before calling .input()/.output()/.to().","Keep a reference to the builder, not the inner SIB node instance."],"tags":["runtime","builder","split-in-batches","connections"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}