{"record":{"id":"39c4d958a8330d1b","repo":"n8n-io/n8n","slug":"subnode-output-connections-are-managed-by-parent-n","errorCode":null,"errorMessage":"Subnode output connections are managed by parent node SubnodeConfig","messagePattern":"Subnode output connections are managed by parent node SubnodeConfig","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@n8n/workflow-sdk/src/workflow-builder/node-builders/subnode-builders.ts","lineNumber":135,"sourceCode":"\t\t\tparameters: config.parameters ?? this.config.parameters,\n\t\t\tcredentials: config.credentials ?? this.config.credentials,\n\t\t};\n\t\treturn new SubnodeInstanceImpl(\n\t\t\tthis.type,\n\t\t\tthis.version,\n\t\t\tmergedConfig,\n\t\t\tthis._subnodeType,\n\t\t\tthis.id,\n\t\t\tthis.name,\n\t\t);\n\t}\n\n\tinput(_index: number): InputTarget {\n\t\tthrow new Error('Subnode input connections are managed by parent node SubnodeConfig');\n\t}\n\n\toutput(_index: number): OutputSelector<TType, TVersion, TOutput> {\n\t\tthrow new Error('Subnode output connections are managed by parent node SubnodeConfig');\n\t}\n\n\tthen<T extends NodeInstance<string, string, unknown>>(\n\t\t_target: T | T[] | InputTarget,\n\t\t_outputIndex?: number,\n\t): NodeChain<NodeInstance<TType, TVersion, TOutput>, T> {\n\t\tthrow new Error('Subnode connections are managed by parent node SubnodeConfig');\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<TType, TVersion, TOutput>, T> {\n\t\tthrow new Error('Subnode connections are managed by parent node SubnodeConfig');\n\t}\n\n\tonError<T extends NodeInstance<string, string, unknown>>(_handler: T): this {\n\t\tthrow new Error('Subnode error handling is managed by parent node SubnodeConfig');","sourceCodeStart":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/workflow-sdk/src/workflow-builder/node-builders/subnode-builders.ts#L117-L153","documentation":"Thrown by SubnodeInstanceImpl.output() — a subnode's output connections are owned by its parent SubnodeConfig. The method is implemented only to conform to the NodeInstance interface; invoking it is a misuse. Use the parent node's API to express how the subnode is wired.","triggerScenarios":"Calling myTool.output(0) to build a connection chain from a tool node, or generic graph traversal code that calls .output() on every NodeInstance.","commonSituations":"Reusing a generic chain builder that assumes all nodes expose outputs; mistakenly treating a tool subnode like a top-level node and chaining .output(...).to(...).","solutions":["Express the subnode's output wiring on the parent SubnodeConfig node, not on the subnode.","Type-guard against SubnodeInstanceImpl before calling .output().","Build connections via the parent's subnode-aware API (e.g. agent.to(...), not tool.output(...).to(...))."],"exampleFix":"// before\nconst sel = toolNode.output(0); // throws\n// after\n// wire the agent (parent SubnodeConfig), not the tool\nagent.to(nextNode);","handlingStrategy":"type-guard","validationCode":"if (!(node instanceof SubnodeInstanceImpl)) {\n  const out = node.output(0);\n}","typeGuard":"function isSubnodeInstance(n: unknown): n is SubnodeInstanceImpl {\n  return n instanceof SubnodeInstanceImpl;\n}","tryCatchPattern":null,"preventionTips":["Never chain .output() off a tool/subnode — use the parent agent.","Type-guard before generic output enumeration.","Document which builder functions return SubnodeInstanceImpl so callers know."],"tags":["subnode","connections","workflow-builder","fluent-api"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}