{"record":{"id":"a113d78f8ad34c96","repo":"PrefectHQ/fastmcp","slug":"module-name-r-has-no-attribute-name-r-a113d7","errorCode":null,"errorMessage":"module {__name__!r} has no attribute {name!r}","messagePattern":"module (.+?) has no attribute (.+?)","errorType":"exception","errorClass":"AttributeError","httpStatus":null,"severity":"error","filePath":"fastmcp_slim/fastmcp/server/providers/__init__.py","lineNumber":69,"sourceCode":"    \"OpenAPIProvider\",\n    \"Provider\",\n    \"ProxyProvider\",\n    \"SkillProvider\",\n    \"SkillsDirectoryProvider\",\n]\n\n\ndef __getattr__(name: str) -> object:\n    \"\"\"Lazy import for providers to avoid circular imports.\"\"\"\n    if name == \"ProxyProvider\":\n        from fastmcp.server.providers.proxy import ProxyProvider\n\n        return ProxyProvider\n    if name == \"OpenAPIProvider\":\n        from fastmcp.server.providers.openapi import OpenAPIProvider\n\n        return OpenAPIProvider\n    raise AttributeError(f\"module {__name__!r} has no attribute {name!r}\")\n","sourceCodeStart":51,"sourceCodeEnd":70,"githubUrl":"https://github.com/PrefectHQ/fastmcp/blob/1f021142978e0861cd910c8df4e8074bc7cf3978/fastmcp_slim/fastmcp/server/providers/__init__.py#L51-L70","documentation":"The fastmcp.server.providers package uses a lazy __getattr__ to import provider classes on demand (e.g. ProxyProvider, OpenAPIProvider). If the requested name is not in the lazy-import table, it raises AttributeError('module ... has no attribute ...').","triggerScenarios":"from fastmcp.server.providers import SomeProvider where SomeProvider is misspelled, removed, or never exported (e.g. FastMCPProvider, CompositeProvider names that live elsewhere).","commonSituations":"Migrating from an older fastmcp version where providers were exported directly; IDE auto-imports guessing a wrong module; internal refactors renaming provider classes.","solutions":["Check the exact class name and import it from its concrete submodule (e.g. fastmcp.server.providers.proxy.ProxyProvider)","Run dir(fastmcp.server.providers) or check docs to see which lazy names exist","Fix the import path after a fastmcp upgrade by reading the changelog"],"exampleFix":"// before\nfrom fastmcp.server.providers import ProxyProvider as P  # ok, but ...\nfrom fastmcp.server.providers import FastMCPProvider  # AttributeError\n\n// after\nfrom fastmcp.server.providers.fastmcp import FastMCPProvider  # concrete submodule","handlingStrategy":"try-catch","validationCode":"import fastmcp.server.providers as p\nif not hasattr(p, 'ProxyProvider'):\n    raise ImportError('This fastmcp version does not lazy-export ProxyProvider')","typeGuard":"def providers_attr(name: str) -> bool:\n    import fastmcp.server.providers as p\n    return name in getattr(p, '__getattr__').__code__.co_consts or hasattr(p, name)","tryCatchPattern":"try:\n    from fastmcp.server.providers import ProxyProvider\nexcept AttributeError:\n    from fastmcp.server.providers.proxy import ProxyProvider  # concrete path","preventionTips":["Import provider classes from their concrete submodules","Pin fastmcp versions and read migration notes on upgrade","Use hasattr/dir to verify lazy exports before importing"],"tags":["import","attributeerror","python","lazy-loading"],"backgroundTag":"missing-module-attribute","analyzedSha":"1f021142978e0861cd910c8df4e8074bc7cf3978","analyzedAt":"2026-08-29T14:31:16.082Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}