{"record":{"id":"14053a23669323c8","repo":"n8n-io/n8n","slug":"name-conflict","errorCode":"NAME_CONFLICT","errorMessage":"A node with the name \"${newName}\" already exists","messagePattern":"A node with the name \"(.+?)\" already exists","errorType":"error_code","errorClass":"ValidationError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/ai-workflow-builder.ee/src/tools/rename-node.tool.ts","lineNumber":96,"sourceCode":"\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 existingNode = workflow.nodes.find(\n\t\t\t\t\t(n) => n.name === newName && n.id !== validatedInput.nodeId,\n\t\t\t\t);\n\t\t\t\tif (existingNode) {\n\t\t\t\t\tconst validationError = new ValidationError(\n\t\t\t\t\t\t`A node with the name \"${newName}\" already exists`,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfield: 'newName',\n\t\t\t\t\t\t\tvalue: newName,\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: validationError.message,\n\t\t\t\t\t\tcode: 'NAME_CONFLICT',\n\t\t\t\t\t\tdetails: {\n\t\t\t\t\t\t\tnodeId: validatedInput.nodeId,\n\t\t\t\t\t\t\tnewName,\n\t\t\t\t\t\t\tconflictingNodeId: existingNode.id,\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=== Rename Node Tool ===');\n\t\t\t\tlogger?.debug(`Renaming node: \"${oldName}\" -> \"${newName}\"`);\n\n\t\t\t\treportProgress(reporter, `Renaming \"${oldName}\" to \"${newName}\"...`);\n\n\t\t\t\tconst message = buildResponseMessage(oldName, newName);\n\n\t\t\t\tlogger?.debug('Node will be renamed');","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/ai-workflow-builder.ee/src/tools/rename-node.tool.ts#L78-L114","documentation":"rename_node found another node in workflow.nodes whose name equals newName and whose id differs from the target. n8n requires node names to be unique (they key the connections object), so the rename is refused with code NAME_CONFLICT and the conflicting node's ID in details.","triggerScenarios":"rename_node with a newName that matches a different node's name.","commonSituations":"Trying to rename to an in-use name; duplicate name after cloning; renaming to a name freed by a not-yet-applied deletion.","solutions":["Choose a unique newName not present in workflow.nodes.","Rename the conflicting node first (or delete it) to free the name.","Append a suffix or counter to disambiguate (e.g. 'Process Data (2)')."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Check name uniqueness before invoking rename_node.\nconst taken = workflow.nodes.some((n) => n.name === newName && n.id !== nodeId);\nif (taken) { /* pick a distinct name or rename the conflicting node first */ }","typeGuard":null,"tryCatchPattern":"const res = await rename_node.invoke(input);\nif (isToolError(res) && res.code === 'NAME_CONFLICT') {\n  const conflictId = (res.details as any).conflictingNodeId;\n  // rename or delete the conflicting node first, then retry\n}","preventionTips":["Always check name uniqueness against workflow.nodes before renaming.","Maintain a set of in-use names in agent state.","Disambiguate with suffixes (e.g. ' (2)') when collisions are likely."],"tags":["workflow-builder","nodes","validation","rename","uniqueness"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}