{"record":{"id":"679526856caae2f7","repo":"n8n-io/n8n","slug":"same-name","errorCode":"SAME_NAME","errorMessage":"Node \"${oldName}\" already has this name","messagePattern":"Node \"(.+?)\" already has this name","errorType":"error_code","errorClass":"ValidationError","httpStatus":null,"severity":"info","filePath":"packages/@n8n/ai-workflow-builder.ee/src/tools/rename-node.tool.ts","lineNumber":72,"sourceCode":"\t\t\t\tconst node = validateNodeExists(validatedInput.nodeId, workflow.nodes);\n\n\t\t\t\tif (!node) {\n\t\t\t\t\tconst error = createNodeNotFoundError(validatedInput.nodeId);\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 oldName = node.name;\n\t\t\t\tconst newName = validatedInput.newName;\n\n\t\t\t\tif (oldName === newName) {\n\t\t\t\t\tconst validationError = new ValidationError(`Node \"${oldName}\" already has this name`, {\n\t\t\t\t\t\tfield: 'newName',\n\t\t\t\t\t\tvalue: newName,\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: 'SAME_NAME',\n\t\t\t\t\t\tdetails: {\n\t\t\t\t\t\t\tnodeId: validatedInput.nodeId,\n\t\t\t\t\t\t\tcurrentName: oldName,\n\t\t\t\t\t\t\tnewName,\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 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',","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/ai-workflow-builder.ee/src/tools/rename-node.tool.ts#L54-L90","documentation":"rename_node detected that newName equals the node's current name (oldName === newName). The tool refuses the no-op rather than performing a redundant write, returning code SAME_NAME with both currentName and newName in details.","triggerScenarios":"rename_node invoked with newName identical to node.name.","commonSituations":"The LLM hallucinates the existing name as the 'new' name; an idempotent retry after a partial success; a client retry loop.","solutions":["Pick a genuinely different newName.","If the goal was only to ensure the node has that name, treat the response as success.","Call list_nodes to confirm current names before renaming."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Compare against the node's current name before invoking rename_node.\nconst node = workflow.nodes.find((n) => n.id === input.nodeId);\nif (node && node.name === input.newName) { /* no-op: nothing to rename */ }","typeGuard":null,"tryCatchPattern":"const res = await rename_node.invoke(input);\nif (isToolError(res) && res.code === 'SAME_NAME') {\n  // desired state already holds; proceed without error\n}","preventionTips":["Skip rename_node when newName equals the current name.","Track current names in agent state to avoid redundant renames.","Treat SAME_NAME as success when the goal is to ensure a name."],"tags":["workflow-builder","nodes","validation","rename"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}