{"record":{"id":"d06850b4419bd838","repo":"PrefectHQ/fastmcp","slug":"multiple-arguments-would-be-mapped-to-the-same-nam","errorCode":null,"errorMessage":"Multiple arguments would be mapped to the same names: {', '.join(sorted(duplicates))}","messagePattern":"Multiple arguments would be mapped to the same names: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"fastmcp_slim/fastmcp/tools/tool_transform.py","lineNumber":590,"sourceCode":"\n                if transform.hide:\n                    continue\n\n                if transform.name is not NotSet:\n                    new_names.append(transform.name)\n                else:\n                    new_names.append(old_name)\n\n            # Check for duplicate names after transformation\n            name_counts = {}\n            for arg_name in new_names:\n                name_counts[arg_name] = name_counts.get(arg_name, 0) + 1\n\n            duplicates = [\n                arg_name for arg_name, count in name_counts.items() if count > 1\n            ]\n            if duplicates:\n                raise ValueError(\n                    f\"Multiple arguments would be mapped to the same names: \"\n                    f\"{', '.join(sorted(duplicates))}\"\n                )\n\n        final_name = name or tool.name\n        final_version = version if not isinstance(version, NotSetT) else tool.version\n        final_description = (\n            description if not isinstance(description, NotSetT) else tool.description\n        )\n        final_title = title if not isinstance(title, NotSetT) else tool.title\n        final_meta = _apply_meta_override(tool.meta, meta)\n        final_annotations = (\n            annotations if not isinstance(annotations, NotSetT) else tool.annotations\n        )\n\n        transformed_tool = cls(\n            fn=final_fn,\n            return_type=parsed_fn.return_type if parsed_fn is not None else None,","sourceCodeStart":572,"sourceCodeEnd":608,"githubUrl":"https://github.com/PrefectHQ/fastmcp/blob/1f021142978e0861cd910c8df4e8074bc7cf3978/fastmcp_slim/fastmcp/tools/tool_transform.py#L572-L608","documentation":"from_tool() computes the final exposed name of every transformed argument (via name= or the resulting name) and rejects transforms where two or more arguments would collide on the same exposed name, since the output schema cannot declare duplicate properties. Raises ValueError with the duplicated names.","triggerScenarios":"Two ArgTransforms in transform_args both set name=\"same_name\" (e.g. merging two params into one without removing the other); an explicit name that collides with another param's final name.","commonSituations":"Attempting to collapse several parent params into one alias while forgetting to drop or hide the others; bulk-generated transforms reusing an alias.","solutions":["Give each ArgTransform a unique name=, or remove/rename the colliding entry.","If merging params intentionally, hide the redundant params and accept a single visible one.","Keep one entry without name= so it keeps its parent name, and rename only the other."],"exampleFix":"// before\ntransform_args={\"a\": ArgTransform(name=\"x\"), \"b\": ArgTransform(name=\"x\")}\n\n// after\ntransform_args={\"a\": ArgTransform(name=\"x\"), \"b\": ArgTransform(name=\"y\")}","handlingStrategy":"validation","validationCode":"def check_name_collisions(transform_args: dict) -> None:\n    names = [t.name or src for src, t in transform_args.items()]\n    dupes = {n for n in names if names.count(n) > 1}\n    if dupes:\n        raise ValueError(f\"Duplicate exposed names: {sorted(dupes)}\")","typeGuard":null,"tryCatchPattern":"try:\n    t = ParentTool.from_tool(tool, transform_args=ta)\nexcept ValueError as e:\n    if \"same names\" in str(e):\n        log.error(\"Resolve duplicate exposed names: %s\", e)\n    raise","preventionTips":["Generate exposed names programmatically (e.g. prefix per source param) instead of hand-typing aliases.","When merging params, hide the redundant ones instead of aliasing both to one name.","Add a unit test asserting unique final names for your transform set."],"tags":["python","tool-transform","validation"],"backgroundTag":"duplicate-parameter-name","analyzedSha":"1f021142978e0861cd910c8df4e8074bc7cf3978","analyzedAt":"2026-08-29T14:31:16.082Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}