{"record":{"id":"0f518bdd820c108d","repo":"PrefectHQ/fastmcp","slug":"cannot-add-unversioned-type-name-logical-name-r","errorCode":null,"errorMessage":"Cannot add unversioned {type_name} {logical_name!r}: versioned {type_name}s with this name already exist (e.g., version={existing.version!r}). Either version all components or none.","messagePattern":"Cannot add unversioned (.+?) (.+?): versioned (.+?)s with this name already exist \\(e\\.g\\., version=(.+?)\\)\\. Either version all components or none\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"fastmcp_slim/fastmcp/server/providers/local_provider/local_provider.py","lineNumber":171,"sourceCode":"            if not isinstance(existing, comp_type):\n                continue\n\n            _, existing_name = self._get_component_identity(existing)\n            if existing_name != logical_name:\n                continue\n\n            existing_versioned = existing.version is not None\n            if is_versioned != existing_versioned:\n                type_name = comp_type.__name__.lower()\n                if is_versioned:\n                    raise ValueError(\n                        f\"Cannot add versioned {type_name} {logical_name!r} \"\n                        f\"(version={component.version!r}): an unversioned \"\n                        f\"{type_name} with this name already exists. \"\n                        f\"Either version all components or none.\"\n                    )\n                else:\n                    raise ValueError(\n                        f\"Cannot add unversioned {type_name} {logical_name!r}: \"\n                        f\"versioned {type_name}s with this name already exist \"\n                        f\"(e.g., version={existing.version!r}). \"\n                        f\"Either version all components or none.\"\n                    )\n\n    def _add_component(self, component: _C) -> _C:\n        \"\"\"Add a component to unified storage.\n\n        Args:\n            component: The component to add.\n\n        Returns:\n            The component that was added (or existing if on_duplicate=\"ignore\").\n        \"\"\"\n        existing = self._components.get(component.key)\n        if existing:\n            if self._on_duplicate == \"error\":","sourceCodeStart":153,"sourceCodeEnd":189,"githubUrl":"https://github.com/PrefectHQ/fastmcp/blob/1f021142978e0861cd910c8df4e8074bc7cf3978/fastmcp_slim/fastmcp/server/providers/local_provider/local_provider.py#L153-L189","documentation":"The mirror case of version-mixing: registering an unversioned component when versioned components of the same type and logical name already exist raises ValueError, because unversioned and versioned identities for the same name cannot coexist.","triggerScenarios":"Calling add_tool/add_resource/add_prompt/add_template with a component lacking a version while versioned components with the same name are already registered.","commonSituations":"Adding a legacy unversioned copy of a tool that was already upgraded to versioned; replaying old registration code against a server that now versions its components.","solutions":["Assign a version to the new component to match the existing scheme.","Remove the versioned components if you intend to go back to unversioned.","Rename the new component to avoid the logical-name collision."],"exampleFix":"// before\nmcp.add_tool(greet_v1, version='1')\nmcp.add_tool(greet_simple)  # raises\n\n// after\nmcp.add_tool(greet_v1, version='1')\nmcp.add_tool(greet_simple, version='1')","handlingStrategy":"validation","validationCode":"def assert_unversioned_allowed(existing_components, new_component):\n    same_name = [c for c in existing_components\n                 if (c.name or c.uri) == (new_component.name or new_component.uri)]\n    if any(c.version is not None for c in same_name) and new_component.version is None:\n        raise ValueError('existing components are versioned; assign a version')","typeGuard":"def version_schemes_match(a, b) -> bool:\n    return (a.version is None) == (b.version is None)","tryCatchPattern":"try:\n    mcp.add_tool(legacy_tool)\nexcept ValueError as e:\n    if 'Cannot add unversioned' in str(e):\n        logging.error('name is versioned; register with version=...')\n    raise","preventionTips":["Version every variant of a given component name once you start versioning.","Migrate legacy unversioned registrations in the same change that introduces versions.","Keep one canonical registration module to avoid divergent schemes."],"tags":["fastmcp","versioning","registration-conflict"],"backgroundTag":"version-scheme-mixing","analyzedSha":"1f021142978e0861cd910c8df4e8074bc7cf3978","analyzedAt":"2026-08-29T14:31:16.082Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}