headroomlabs-ai/headroom · error · AttributeError
module {__name__!r} has no attribute {name!r}
Error message
module {__name__!r} has no attribute {name!r} What it means
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.
Source
Thrown at headroom/memory/adapters/__init__.py:99
_LocalEmbedder = LocalEmbedder
return _LocalEmbedder
if name == "OpenAIEmbedder":
if _OpenAIEmbedder is None:
from headroom.memory.adapters.embedders import OpenAIEmbedder
_OpenAIEmbedder = OpenAIEmbedder
return _OpenAIEmbedder
if name == "OllamaEmbedder":
if _OllamaEmbedder is None:
from headroom.memory.adapters.embedders import OllamaEmbedder
_OllamaEmbedder = OllamaEmbedder
return _OllamaEmbedder
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
__all__ = [
# Core adapters (always available)
"FTS5TextIndex",
"InMemoryGraphStore",
"LRUMemoryCache",
"SQLiteGraphStore",
"SQLiteMemoryStore",
# Optional adapters (lazy-loaded)
"HNSWVectorIndex",
"SQLiteVectorIndex",
"LocalEmbedder",
"OllamaEmbedder",
"OpenAIEmbedder",
# Availability flags
"HNSW_AVAILABLE",
"SQLITE_VEC_AVAILABLE",View on GitHub (pinned to 322425c43b)
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.
Example fix
# before from headroom.memory.adapters import OpenAiEmbedder # AttributeError # after from headroom.memory.adapters import OpenAIEmbedder # exact name from __all__
Defensive patterns
Strategy: type-guard
Validate before calling
from headroom.memory import adapters
wanted = "OpenAIEmbedder"
if wanted not in adapters.__all__:
raise SystemExit(f"{wanted!r} not exported; valid: {adapters.__all__}") Type guard
from headroom.memory import adapters
def adapter_exports(name: str) -> bool:
"""True if name is (lazily) exported by headroom.memory.adapters."""
return name in adapters.__all__ Try / catch
try:
from headroom.memory.adapters import OpenAIEmbedder
except AttributeError:
from headroom.memory.adapters.embedders import OpenAIEmbedder # defining module always works Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- module {__name__!r} has no attribute {name!r}
- module {__name__!r} has no attribute {name!r}
- any-llm-sdk is required for AnyLLMBackend. Install with: pip
- litellm is required for LiteLLMBackend. Install with: pip in
- Magika is required for ML-based content detection. Install w
AI-assisted analysis of headroomlabs-ai/headroom@322425c43b (2026-08-15).
Data as JSON: /api/errors/648ca0c8040b4cde.
Report an issue: GitHub.