{"record":{"id":"c86fe70329cbee6a","repo":"PrefectHQ/fastmcp","slug":"module-name-r-has-no-attribute-name-r-c86fe7","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/auth/__init__.py","lineNumber":61,"sourceCode":"\n        return JWTVerifier\n    if name == \"StaticTokenVerifier\":\n        from .providers.jwt import StaticTokenVerifier\n\n        return StaticTokenVerifier\n    if name == \"IdentityAssertion\":\n        from .identity_assertion import IdentityAssertion\n\n        return IdentityAssertion\n    if name == \"OAuthProxy\":\n        from .oauth_proxy import OAuthProxy\n\n        return OAuthProxy\n    if name == \"OIDCProxy\":\n        from .oidc_proxy import OIDCProxy\n\n        return OIDCProxy\n    raise AttributeError(f\"module {__name__!r} has no attribute {name!r}\")\n\n\n__all__ = [\n    \"AccessToken\",\n    \"AuthCheck\",\n    \"AuthContext\",\n    \"AuthProvider\",\n    \"DebugTokenVerifier\",\n    \"IdentityAssertion\",\n    \"JWTVerifier\",\n    \"MultiAuth\",\n    \"OAuthProvider\",\n    \"OAuthProxy\",\n    \"OIDCProxy\",\n    \"RemoteAuthProvider\",\n    \"StaticTokenVerifier\",\n    \"TokenVerifier\",\n    \"require_roles\",","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/PrefectHQ/fastmcp/blob/1f021142978e0861cd910c8df4e8074bc7cf3978/fastmcp_slim/fastmcp/server/auth/__init__.py#L43-L79","documentation":"fastmcp.server.auth also uses PEP 562 lazy attribute loading for its OAuth proxy classes; any name not in its handled set (AccessToken, OAuthProxy, OIDCProxy, etc.) hits the final `raise AttributeError(f\"module {__name__!r} has no attribute {name!r}\")`. It means the requested auth symbol doesn't exist at that path.","triggerScenarios":"Execute `from fastmcp.server.auth import SomeAuth` or getattr(fastmcp.server.auth, name) with a name not matched by the __getattr__ branches — fallthrough at fastmcp_slim/fastmcp/server/auth/__init__.py:61.","commonSituations":"Typos like `OauthProxy` or `JWTVerifier` living in a different submodule; version changes moving/renaming auth providers; tutorials referencing symbols from fastmcp.server.auth.providers.* but imported from the package root; dynamic provider selection from config.","solutions":["Check the module's __all__ / docs for the exact exported names (case-sensitive: OAuthProxy, OIDCProxy).","Import specialized providers from their submodules, e.g. fastmcp.server.auth.providers.jwt / bearer.","If following an older example, update to current symbol names — auth class names changed across FastMCP versions.","For dynamic selection, map config strings to imports explicitly instead of getattr on the package."],"exampleFix":"// before\nfrom fastmcp.server.auth import BearerAuthProvider  # not exported here\n\n// after\nfrom fastmcp.server.auth.providers.jwt import JWTVerifier  # current location","handlingStrategy":"validation","validationCode":"import fastmcp.server.auth as auth\nname = 'OAuthProxy'\nif name not in auth.__all__:\n    raise AttributeError(f'{name} not exported by fastmcp.server.auth; available: {auth.__all__}')","typeGuard":null,"tryCatchPattern":"try:\n    provider_cls = getattr(auth, config['auth_provider'])\nexcept AttributeError as e:\n    raise ValueError(f'unknown auth provider {config[\"auth_provider\"]!r}') from e","preventionTips":["Import specialized auth providers from their submodules.","Match exported names exactly (case-sensitive).","Validate configured provider names against __all__ at startup."],"tags":["imports","attributeerror","auth","lazy-loading"],"backgroundTag":"module-has-no-attribute","analyzedSha":"1f021142978e0861cd910c8df4e8074bc7cf3978","analyzedAt":"2026-08-29T14:31:16.082Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}