{"record":{"id":"8449f98a3e0d8dbc","repo":"n8n-io/n8n","slug":"connection-not-found","errorCode":"CONNECTION_NOT_FOUND","errorMessage":"Source node \"${sourceNode.name}\" has no outgoing connections","messagePattern":"Source node \"(.+?)\" has no outgoing connections","errorType":"error_code","errorClass":"ConnectionError","httpStatus":null,"severity":"warning","filePath":"packages/@n8n/ai-workflow-builder.ee/src/tools/remove-connection.tool.ts","lineNumber":142,"sourceCode":"\t\t\t\t// Report progress\n\t\t\t\treportProgress(\n\t\t\t\t\treporter,\n\t\t\t\t\t`Removing connection from ${sourceNode.name} to ${targetNode.name}...`,\n\t\t\t\t);\n\n\t\t\t\t// Check if the connection exists\n\t\t\t\tconst sourceConnections = workflow.connections[sourceNode.name];\n\t\t\t\tif (!sourceConnections) {\n\t\t\t\t\tconst connectionError = new ConnectionError(\n\t\t\t\t\t\t`Source node \"${sourceNode.name}\" has no outgoing connections`,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfromNodeId: sourceNode.id,\n\t\t\t\t\t\t\ttoNodeId: targetNode.id,\n\t\t\t\t\t\t},\n\t\t\t\t\t);\n\t\t\t\t\tconst error = {\n\t\t\t\t\t\tmessage: connectionError.message,\n\t\t\t\t\t\tcode: 'CONNECTION_NOT_FOUND',\n\t\t\t\t\t\tdetails: {\n\t\t\t\t\t\t\tsourceNode: sourceNode.name,\n\t\t\t\t\t\t\ttargetNode: targetNode.name,\n\t\t\t\t\t\t\tconnectionType: validatedInput.connectionType,\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t\treporter.error(error);\n\t\t\t\t\treturn createErrorResponse(config, error);\n\t\t\t\t}\n\n\t\t\t\tconst connectionTypeOutputs = sourceConnections[validatedInput.connectionType];\n\t\t\t\tif (!connectionTypeOutputs || !Array.isArray(connectionTypeOutputs)) {\n\t\t\t\t\tconst connectionError = new ConnectionError(\n\t\t\t\t\t\t`Source node \"${sourceNode.name}\" has no connections of type \"${validatedInput.connectionType}\"`,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfromNodeId: sourceNode.id,\n\t\t\t\t\t\t\ttoNodeId: targetNode.id,\n\t\t\t\t\t\t},","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/ai-workflow-builder.ee/src/tools/remove-connection.tool.ts#L124-L160","documentation":"remove_connection found that workflow.connections has no key for sourceNode.name at all, meaning the source node has zero outgoing connections of any type. The tool refuses to proceed because there is nothing to remove.","triggerScenarios":"Calling remove_connection on a source node that was never connected, or whose connections object was never initialized.","commonSituations":"Trigger/terminal node with no downstream; connection was already removed in a prior call; freshly added node not yet wired.","solutions":["Verify the source actually has outgoing connections via get_node_details or get_workflow.","Use the correct source node (the upstream producer).","Treat as already-disconnected (idempotent success) if the goal was simply to ensure no connection exists."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Inspect workflow.connections before calling remove_connection.\nfunction hasOutgoing(workflow: SimpleWorkflow, sourceName: string): boolean {\n  return Object.prototype.hasOwnProperty.call(workflow.connections, sourceName);\n}\n\nif (!hasOutgoing(workflow, sourceNode.name)) { /* nothing to remove; treat as success */ }","typeGuard":null,"tryCatchPattern":"const res = await remove_connection.invoke(input);\nif (isToolError(res) && res.code === 'CONNECTION_NOT_FOUND') {\n  // idempotent: the source has no outgoing connections, so the desired state holds.\n}","preventionTips":["Treat remove_connection as idempotent when CONNECTION_NOT_FOUND is returned.","Inspect workflow.connections keyed by source name before disconnecting.","Track connection lifecycle in agent state to avoid redundant remove calls."],"tags":["workflow-builder","connections","state","remove"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}