{"record":{"id":"bfea9e53808233ed","repo":"n8n-io/n8n","slug":"cannot-call-input-on-the-workflow-builder-use","errorCode":null,"errorMessage":"Cannot call .input() on the workflow builder. Use .input() on a node variable instead: myNode.input(1)","messagePattern":"Cannot call \\.input\\(\\) on the workflow builder\\. Use \\.input\\(\\) on a node variable instead: myNode\\.input\\(1\\)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@n8n/workflow-sdk/src/workflow-builder.ts","lineNumber":457,"sourceCode":"\n\t\tthis._currentNode = sourceKey;\n\t\tthis._currentOutput = outputIndex;\n\t\tthis.to(target as NodeInstance<string, string, unknown>);\n\t\t// Re-anchor the cursor on the branching node so the next sibling branch wires correctly.\n\t\tthis._currentNode = sourceKey;\n\t\tthis._currentOutput = 0;\n\t\treturn this;\n\t}\n\n\toutput(): never {\n\t\tthrow new Error(\n\t\t\t'Cannot call .output() on the workflow builder. ' +\n\t\t\t\t'Use .output() on a node variable instead: myNode.output(0).to(targetNode)',\n\t\t);\n\t}\n\n\tinput(): never {\n\t\tthrow new Error(\n\t\t\t'Cannot call .input() on the workflow builder. ' +\n\t\t\t\t'Use .input() on a node variable instead: myNode.input(1)',\n\t\t);\n\t}\n\n\tsettings(settings: WorkflowSettings): WorkflowBuilder {\n\t\tthis._settings = { ...this._settings, ...settings };\n\t\treturn this;\n\t}\n\n\tconnect(\n\t\tsource: NodeInstance<string, string, unknown>,\n\t\tsourceOutput: number,\n\t\ttarget: NodeInstance<string, string, unknown>,\n\t\ttargetInput: number,\n\t): WorkflowBuilder {\n\t\t// Ensure both nodes exist in the graph\n\t\tif (!this._nodes.has(source.name)) {","sourceCodeStart":439,"sourceCodeEnd":475,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/workflow-sdk/src/workflow-builder.ts#L439-L475","documentation":"Symmetric to the .output() guard: the WorkflowBuilder object has no .input(). Input selection is a node-level concept (selecting which input index of a node to wire into). The method is defined on the builder solely to throw a guiding error when a caller writes workflow.input(1) instead of myNode.input(1).","triggerScenarios":"Typing workflow.input(1) instead of node.input(1). Typically arises when wiring a target's input index and the caller applies the call to the workflow rather than the node handle.","commonSituations":"Misreading fluent chain examples; autocomplete selecting the workflow's input() stub over the node's; refactoring that detaches the node variable.","solutions":["Call .input(index) on the node handle: myNode.input(1).to(...) or pass it to workflow.add().","Re-confirm the node variable is in scope before chaining."],"exampleFix":"// before\nworkflow.input(1).to(target); // throws\n\n// after\nconst myNode = node({ type: 'Merge' });\nworkflow.add(myNode.input(1).to(target));","handlingStrategy":"type-guard","validationCode":"if (typeof (wf as any).input === 'function') {\n  // .input() on the builder always throws; call it on a node handle instead.\n}\nconst myNode = node({ type: 'Merge' });\nconst selector = myNode.input(1); // correct","typeGuard":"function isWorkflowBuilder(v: unknown): v is WorkflowBuilder {\n  return typeof v === 'object' && v !== null && 'add' in v && 'to' in v && 'settings' in v;\n}","tryCatchPattern":null,"preventionTips":["Never call .input() on the workflow object; capture a node handle first.","Confirm node variables are in scope before chaining .input().","Use workflow.connect() for explicit input wiring when in doubt."],"tags":["workflow-builder","api-misuse","input-selector"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}