{"record":{"id":"648ca0c8040b4cde","repo":"headroomlabs-ai/headroom","slug":"module-name-r-has-no-attribute-name-r-648ca0","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/adapters/__init__.py","lineNumber":99,"sourceCode":"\n            _LocalEmbedder = LocalEmbedder\n        return _LocalEmbedder\n\n    if name == \"OpenAIEmbedder\":\n        if _OpenAIEmbedder is None:\n            from headroom.memory.adapters.embedders import OpenAIEmbedder\n\n            _OpenAIEmbedder = OpenAIEmbedder\n        return _OpenAIEmbedder\n\n    if name == \"OllamaEmbedder\":\n        if _OllamaEmbedder is None:\n            from headroom.memory.adapters.embedders import OllamaEmbedder\n\n            _OllamaEmbedder = OllamaEmbedder\n        return _OllamaEmbedder\n\n    raise AttributeError(f\"module {__name__!r} has no attribute {name!r}\")\n\n\n__all__ = [\n    # Core adapters (always available)\n    \"FTS5TextIndex\",\n    \"InMemoryGraphStore\",\n    \"LRUMemoryCache\",\n    \"SQLiteGraphStore\",\n    \"SQLiteMemoryStore\",\n    # Optional adapters (lazy-loaded)\n    \"HNSWVectorIndex\",\n    \"SQLiteVectorIndex\",\n    \"LocalEmbedder\",\n    \"OllamaEmbedder\",\n    \"OpenAIEmbedder\",\n    # Availability flags\n    \"HNSW_AVAILABLE\",\n    \"SQLITE_VEC_AVAILABLE\",","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/headroomlabs-ai/headroom/blob/322425c43bffde1ed0b64fecf3cf5951565dd82b/headroom/memory/adapters/__init__.py#L81-L117","documentation":"headroom.memory.adapters uses a module __getattr__ to lazy-load optional heavy adapters (HNSWVectorIndex, SQLiteVectorIndex, OpenAIEmbedder, OllamaEmbedder, ...). This AttributeError is raised when the requested attribute matches none of the known lazy names — a typo, a symbol that lives in a sibling module (e.g. embedders.py directly), or a name removed/renamed across versions.","triggerScenarios":"from headroom.memory.adapters import OpenAIEmbedders (typo), or importing a class the package never re-exports (e.g. something defined only inside embedders.py but not registered as a lazy alias), or accessing an adapter removed in a headroom upgrade.","commonSituations":"Autocomplete-driven imports of names that exist in the file but not in the package namespace; refactors that moved classes between adapter modules; code targeting a different headroom version than installed.","solutions":["Consult __all__ at the bottom of headroom/memory/adapters/__init__.py and import only those names.","Import directly from the defining module: from headroom.memory.adapters.embedders import OpenAIEmbedder.","Fix typos/pluralization ('OpenAIEmbedder' is singular).","Pin or upgrade headroom to the version your code was written against."],"exampleFix":"# before\nfrom headroom.memory.adapters import OpenAiEmbedder  # AttributeError\n\n# after\nfrom headroom.memory.adapters import OpenAIEmbedder  # exact name from __all__","handlingStrategy":"type-guard","validationCode":"from headroom.memory import adapters\n\nwanted = \"OpenAIEmbedder\"\nif wanted not in adapters.__all__:\n    raise SystemExit(f\"{wanted!r} not exported; valid: {adapters.__all__}\")","typeGuard":"from headroom.memory import adapters\n\ndef adapter_exports(name: str) -> bool:\n    \"\"\"True if name is (lazily) exported by headroom.memory.adapters.\"\"\"\n    return name in adapters.__all__","tryCatchPattern":"try:\n    from headroom.memory.adapters import OpenAIEmbedder\nexcept AttributeError:\n    from headroom.memory.adapters.embedders import OpenAIEmbedder  # defining module always works","preventionTips":["When in doubt, import directly from the defining module (adapters.embedders, adapters.hnsw, ...).","Static-check imports with ruff/mypy strict so unknown names fail in CI, not at runtime.","Copy names from __all__ rather than from autocomplete suggestions."],"tags":["python","import","lazy-loading","adapters","memory"],"backgroundTag":null,"analyzedSha":"322425c43bffde1ed0b64fecf3cf5951565dd82b","analyzedAt":"2026-08-15T01:03:05.481Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}