{"record":{"id":"018af4935a3d2698","repo":"n8n-io/n8n","slug":"nodes-not-found-018af4","errorCode":"NODES_NOT_FOUND","errorMessage":"Node with ID \"${nodeId}\" not found in workflow","messagePattern":"Node with ID \"(.+?)\" not found in workflow","errorType":"error_code","errorClass":"NodeNotFoundError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/ai-workflow-builder.ee/src/tools/remove-connection.tool.ts","lineNumber":107,"sourceCode":"\t\t\t\tconst state = getWorkflowState();\n\t\t\t\tconst workflow = getCurrentWorkflow(state);\n\n\t\t\t\t// Report progress\n\t\t\t\treportProgress(reporter, 'Finding nodes to disconnect...');\n\n\t\t\t\t// Find source and target nodes\n\t\t\t\tconst sourceNode = validateNodeExists(validatedInput.sourceNodeId, workflow.nodes);\n\t\t\t\tconst targetNode = validateNodeExists(validatedInput.targetNodeId, workflow.nodes);\n\n\t\t\t\t// Check if both nodes exist\n\t\t\t\tif (!sourceNode || !targetNode) {\n\t\t\t\t\tconst missingNodeId = !sourceNode\n\t\t\t\t\t\t? validatedInput.sourceNodeId\n\t\t\t\t\t\t: validatedInput.targetNodeId;\n\t\t\t\t\tconst nodeError = new NodeNotFoundError(missingNodeId);\n\t\t\t\t\tconst error = {\n\t\t\t\t\t\tmessage: nodeError.message,\n\t\t\t\t\t\tcode: 'NODES_NOT_FOUND',\n\t\t\t\t\t\tdetails: {\n\t\t\t\t\t\t\tsourceNodeId: validatedInput.sourceNodeId,\n\t\t\t\t\t\t\ttargetNodeId: validatedInput.targetNodeId,\n\t\t\t\t\t\t\tfoundSource: !!sourceNode,\n\t\t\t\t\t\t\tfoundTarget: !!targetNode,\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\tlogger?.debug('\\n=== Remove Connection Tool ===');\n\t\t\t\tlogger?.debug(\n\t\t\t\t\t`Attempting to remove connection: ${sourceNode.name} -> ${targetNode.name} (${validatedInput.connectionType})`,\n\t\t\t\t);\n\n\t\t\t\t// Report progress\n\t\t\t\treportProgress(","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/ai-workflow-builder.ee/src/tools/remove-connection.tool.ts#L89-L125","documentation":"Thrown by remove_connection when validateNodeExists returns null for sourceNodeId and/or targetNodeId. The error includes foundSource and foundTarget booleans so the caller can tell which side is missing. Code is NODES_NOT_FOUND (plural) to distinguish from the single-node NODE_NOT_FOUND factory.","triggerScenarios":"remove_connection invoked with a sourceNodeId or targetNodeId that does not match any node.id in workflow.nodes.","commonSituations":"Node was deleted between connect and disconnect; stale UUID; wrong workflow; ID typo.","solutions":["Inspect details.foundSource and details.foundTarget to identify the missing side.","Resolve current IDs via list_nodes.","Re-issue remove_connection with valid IDs."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import { validateNodeExists } from '@/tools/helpers/validation';\n\nconst src = validateNodeExists(input.sourceNodeId, workflow.nodes);\nconst tgt = validateNodeExists(input.targetNodeId, workflow.nodes);\nif (!src || !tgt) { /* surface which side is missing, refresh IDs */ }","typeGuard":"function isToolError(v: unknown): v is { message: string; code: string; details?: { foundSource?: boolean; foundTarget?: boolean } } {\n  return typeof v === 'object' && v !== null && 'code' in v && (v as any).code === 'NODES_NOT_FOUND';\n}","tryCatchPattern":"const res = await remove_connection.invoke(input);\nif (isToolError(res) && res.code === 'NODES_NOT_FOUND') {\n  if (!res.details?.foundSource) { /* re-resolve source */ }\n  if (!res.details?.foundTarget) { /* re-resolve target */ }\n}","preventionTips":["Re-resolve node IDs after any add/delete operation.","Pass stable UUIDs, not names, to remove_connection.","Track deleted node IDs in the agent state to avoid stale references."],"tags":["workflow-builder","connections","nodes","lookup"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}