{"record":{"id":"77c4401a21e3a70c","repo":"n8n-io/n8n","slug":"connection-type-not-found","errorCode":"CONNECTION_TYPE_NOT_FOUND","errorMessage":"Source node \"${sourceNode.name}\" has no connections of type \"${validatedInput.connectionType}\"","messagePattern":"Source node \"(.+?)\" has no connections of type \"(.+?)\"","errorType":"error_code","errorClass":"ConnectionError","httpStatus":null,"severity":"warning","filePath":"packages/@n8n/ai-workflow-builder.ee/src/tools/remove-connection.tool.ts","lineNumber":164,"sourceCode":"\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},\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_TYPE_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\tavailableConnectionTypes: Object.keys(sourceConnections),\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 outputConnections = connectionTypeOutputs[validatedInput.sourceOutputIndex];\n\t\t\t\tif (!outputConnections || !Array.isArray(outputConnections)) {\n\t\t\t\t\tconst connectionError = new ConnectionError(\n\t\t\t\t\t\t`Source node \"${sourceNode.name}\" has no connections at output index ${validatedInput.sourceOutputIndex}`,\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,","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/ai-workflow-builder.ee/src/tools/remove-connection.tool.ts#L146-L182","documentation":"remove_connection found the source node's connections object, but it has no entry under the requested connectionType key. details.availableConnectionTypes lists the types that ARE present, so the caller can pick the right one.","triggerScenarios":"Calling remove_connection with connectionType: 'ai_languageModel' when the source only has 'main' connections, or vice versa.","commonSituations":"Wrong connection type passed (defaulted to 'main' but the link is an AI sub-node connection); type inferred from the wrong node role; refactor moved a connection to a different type.","solutions":["Read details.availableConnectionTypes.","Re-issue remove_connection with one of the listed types.","Omit connectionType entirely to use the 'main' default if appropriate."],"exampleFix":"// before\nremove_connection.invoke({ sourceNodeId, targetNodeId, connectionType: 'ai_languageModel' });\n// after (use an available type from details.availableConnectionTypes)\nremove_connection.invoke({ sourceNodeId, targetNodeId, connectionType: 'main' });","handlingStrategy":"validation","validationCode":"// List the connection types actually present on the source before removing.\nconst types = Object.keys(workflow.connections[sourceNode.name] ?? {});\nif (!types.includes(requestedType)) { /* pick from types, or default to 'main' */ }","typeGuard":null,"tryCatchPattern":"const res = await remove_connection.invoke(input);\nif (isToolError(res) && res.code === 'CONNECTION_TYPE_NOT_FOUND') {\n  const avail = (res.details as any).availableConnectionTypes as string[];\n  // re-invoke with one of `avail`\n}","preventionTips":["Read availableConnectionTypes from the response and re-issue with a valid type.","Default to 'main' unless the connection is known to be an AI sub-node link.","Cache the connection-type topology per source node to avoid trial-and-error."],"tags":["workflow-builder","connections","validation","remove"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}