{"record":{"id":"b6f92e12e4462be9","repo":"sgl-project/sglang","slug":"module-name-r-has-no-attribute-name-r-b6f92e","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":"python/sglang/kernels/ops/diffusion/__init__.py","lineNumber":495,"sourceCode":"    \"unmount_lingbot_video_rmsnorm\": \"sites.lingbot_video_rmsnorm_site\",\n    \"mark_sana_video_linear_attention_site\": \"sites.sana_video_linear_attention_site\",\n    \"mount_sana_video_linear_attention\": \"sites.sana_video_linear_attention_site\",\n    \"sana_video_linear_attention_active\": \"sites.sana_video_linear_attention_site\",\n    \"try_sana_video_linear_attention\": \"sites.sana_video_linear_attention_site\",\n    \"unmount_sana_video_linear_attention\": \"sites.sana_video_linear_attention_site\",\n    \"QualityGatedFusion\": \"sites.quality_gate\",\n    # JIT C++/CUDA extensions (not kernels, not in the registry)\n    \"interpolate\": \"ext.hunyuan3d_rasterizer\",\n    \"rasterize\": \"ext.hunyuan3d_rasterizer\",\n    \"meshVerticeInpaint\": \"ext.mesh_processor\",\n}\n\n\ndef __getattr__(name: str) -> Any:\n    \"\"\"Resolve a public symbol to its submodule on first access (PEP 562).\"\"\"\n    module = _EXPORTS.get(name)\n    if module is None:\n        raise AttributeError(f\"module {__name__!r} has no attribute {name!r}\")\n    from importlib import import_module\n\n    value = getattr(import_module(f\"{__name__}.{module}\"), name)\n    globals()[name] = value  # cache; later lookups skip __getattr__ entirely\n    return value\n\n\ndef __dir__() -> list[str]:\n    return sorted(set(globals()) | set(_EXPORTS))\n\n\n__all__ = sorted(_EXPORTS)\n","sourceCodeStart":477,"sourceCodeEnd":508,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/kernels/ops/diffusion/__init__.py#L477-L508","documentation":"The diffusion package uses PEP 562 lazy imports: its __getattr__ resolves public names listed in _EXPORTS to their defining submodule on first access. If the requested attribute is not in _EXPORTS at all, it raises a plain AttributeError (module has no attribute), which for `from ... import x` surfaces as ImportError.","triggerScenarios":"Accessing sglang.kernels.ops.diffusion.<name> where <name> is a typo (e.g. `fused_bias_sliu`) or a private/internal symbol never registered in _EXPORTS.","commonSituations":"IDE autocompletion guessing wrong names, using a symbol renamed between sglang versions, or trying to reach a helper function that was never exported.","solutions":["Check the package's _EXPORTS mapping (or its __all__) for the exact public name","Update sglang if the symbol was renamed — consult the module's changelog","Import the internal helper from its concrete submodule path if you truly need it"],"exampleFix":"# before\nfrom sglang.kernels.ops.diffusion import fused_bias_sliu  # typo\n# after\nfrom sglang.kernels.ops.diffusion import fused_bias_silu","handlingStrategy":"validation","validationCode":"from sglang.kernels.ops import diffusion\nassert hasattr(diffusion, name), f'{name} not exported; check diffusion._EXPORTS'","typeGuard":"def diffusion_exports(name: str) -> bool:\n    from sglang.kernels.ops.diffusion import _EXPORTS\n    return name in _EXPORTS","tryCatchPattern":null,"preventionTips":["Import public symbols from the package, not private submodules","After upgrading sglang, grep _EXPORTS for renamed symbols"],"tags":["import","lazy-loading","attribute-error","diffusion"],"backgroundTag":"module-attribute-not-found","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}