{"record":{"id":"aca59e7f653f92ce","repo":"headroomlabs-ai/headroom","slug":"module-name-r-has-no-attribute-name-r","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":"headroom/memory/__init__.py","lineNumber":190,"sourceCode":"\n            _Mem0Config = Mem0Config\n        return _Mem0Config\n\n    if name == \"DirectMem0Adapter\":\n        if _DirectMem0Adapter is None:\n            from headroom.memory.backends.direct_mem0 import DirectMem0Adapter\n\n            _DirectMem0Adapter = DirectMem0Adapter\n        return _DirectMem0Adapter\n\n    if name == \"DirectMem0Config\":\n        if _DirectMem0Config is None:\n            from headroom.memory.backends.direct_mem0 import Mem0Config as DirectMem0Config\n\n            _DirectMem0Config = DirectMem0Config\n        return _DirectMem0Config\n\n    raise AttributeError(f\"module {__name__!r} has no attribute {name!r}\")\n\n\n__all__ = [\n    # =========================================================================\n    # Simple API (recommended for most users)\n    # =========================================================================\n    \"Memory\",  # Zero-config memory class\n    \"MemoryResult\",  # Search result dataclass\n    # =========================================================================\n    # LLM Wrapper API\n    # =========================================================================\n    \"with_memory\",\n    \"MemoryWrapper\",\n    # Tool-based wrapper\n    \"with_memory_tools\",\n    \"MemoryToolsWrapper\",\n    # =========================================================================\n    # Core orchestrator","sourceCodeStart":172,"sourceCodeEnd":208,"githubUrl":"https://github.com/headroomlabs-ai/headroom/blob/322425c43bffde1ed0b64fecf3cf5951565dd82b/headroom/memory/__init__.py#L172-L208","documentation":"headroom.memory implements lazy submodule loading via a module-level __getattr__: names like DirectMem0Adapter and DirectMem0Config are imported from headroom.memory.backends.direct_mem0 only on first access. This AttributeError is the fallback branch meaning the requested name is neither eagerly exported nor one of the known lazily-imported optional symbols — i.e. a typo or a symbol that lives elsewhere.","triggerScenarios":"from headroom.memory import Something with a misspelled name (e.g. Mem0Config instead of DirectMem0Config), or accessing an attribute that only exists on a submodule (headroom.memory.backends...) directly on the package, or referencing an optional adapter class whose lazy branch was renamed in a newer headroom version.","commonSituations":"IDE autocomplete suggesting submodule names; version upgrades that moved/renamed lazily-loaded backends; code written against headroom.memory.backends.* but importing from headroom.memory; `from headroom.memory import *` users hitting names not in __all__.","solutions":["Check the module's __all__ (printed right below the raise) and use one of those names.","Import from the correct submodule: from headroom.memory.backends.direct_mem0 import Mem0Config, or from headroom.memory.adapters... for adapters.","Verify spelling and casing exactly against the headroom version you have installed.","If upgrading headroom changed the API, read the changelog for renamed lazy symbols."],"exampleFix":"# before\nfrom headroom.memory import Mem0Config\n# AttributeError: module 'headroom.memory' has no attribute 'Mem0Config'\n\n# after\nfrom headroom.memory import DirectMem0Config  # the registered lazy alias","handlingStrategy":"type-guard","validationCode":"import headroom.memory as hm\n\nwanted = \"DirectMem0Config\"\nif not (hasattr(hm, wanted) or wanted in getattr(hm, \"__all__\", ())):\n    raise SystemExit(f\"{wanted} is not exported by headroom.memory; check __all__\")","typeGuard":"import headroom.memory as hm\n\ndef memory_exports(name: str) -> bool:\n    \"\"\"True if name is importable from headroom.memory (eager or lazy).\"\"\"\n    return name in hm.__all__ or hasattr(hm, name)","tryCatchPattern":"try:\n    from headroom.memory import DirectMem0Config\nexcept AttributeError as e:\n    raise SystemExit(\n        f\"{e}; import from the defining submodule instead: \"\n        \"from headroom.memory.backends.direct_mem0 import Mem0Config\"\n    ) from None","preventionTips":["Program against __all__, not against names you remember from source browsing.","For deep/optional classes, import from the submodule that defines them.","After upgrading headroom, grep its __all__ lists for renames before assuming removal."],"tags":["python","import","lazy-loading","memory","attributeerror"],"backgroundTag":null,"analyzedSha":"322425c43bffde1ed0b64fecf3cf5951565dd82b","analyzedAt":"2026-08-15T01:03:05.481Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}