headroomlabs-ai/headroom · error · ValueError
default_importance must be 0.0-1.0, got {self.default_import
Error message
default_importance must be 0.0-1.0, got {self.default_importance} What it means
ValueError raised in MemoryBridgeConfig.__post_init__ when default_importance is outside [0.0, 1.0]. The bridge assigns this importance to imported memories, and the rest of the memory system treats importance as a normalized float, so out-of-range values are rejected at config construction time.
Source
Thrown at headroom/memory/bridge_config.py:64
md_format: MarkdownFormat = MarkdownFormat.AUTO
user_id: str = "default"
default_importance: float = 0.6
heading_importance_map: dict[int, float] = field(
default_factory=lambda: {1: 0.9, 2: 0.8, 3: 0.7, 4: 0.6, 5: 0.5, 6: 0.4}
)
sync_state_path: Path = field(default_factory=_paths.bridge_state_path)
auto_import_on_startup: bool = False
export_path: Path | None = None
export_format: MarkdownFormat = MarkdownFormat.GENERIC
extract_entities: bool = True
chunk_by_section: bool = True
dedup_similarity_threshold: float = 0.92
source_tag: str = "memory_bridge"
def __post_init__(self) -> None:
"""Validate configuration."""
if not 0.0 <= self.default_importance <= 1.0:
raise ValueError(f"default_importance must be 0.0-1.0, got {self.default_importance}")
if not 0.0 <= self.dedup_similarity_threshold <= 1.0:
raise ValueError(
f"dedup_similarity_threshold must be 0.0-1.0, got {self.dedup_similarity_threshold}"
)
self.md_paths = [Path(p) if isinstance(p, str) else p for p in self.md_paths]
if isinstance(self.sync_state_path, str):
self.sync_state_path = Path(self.sync_state_path)
if self.export_path and isinstance(self.export_path, str):
self.export_path = Path(self.export_path)
View on GitHub (pinned to 322425c43b)
Solutions
- Use a fraction in [0.0, 1.0], e.g. default_importance=0.75
- If your config uses 1-10, convert before constructing: default_importance=raw / 10.0
- Add a unit check where the config value originates (YAML/CLI parser) so bad values fail with clearer context
Example fix
# before cfg = MemoryBridgeConfig(default_importance=75) # ValueError: must be 0.0-1.0 # after cfg = MemoryBridgeConfig(default_importance=0.75)
Defensive patterns
Strategy: validation
Validate before calling
def clamp_fraction(name: str, value: float) -> float:
if not 0.0 <= value <= 1.0:
raise ValueError(f'{name} must be in [0,1], got {value}')
return value
cfg = MemoryBridgeConfig(
default_importance=clamp_fraction('default_importance', raw_importance),
) Type guard
def is_valid_importance(v) -> bool:
return isinstance(v, (int, float)) and not isinstance(v, bool) and 0.0 <= v <= 1.0 Try / catch
try:
cfg = MemoryBridgeConfig(default_importance=raw)
except ValueError as e:
logger.error('bridge config invalid: %s', e)
cfg = MemoryBridgeConfig() # fall back to defaults Prevention
- Document the 0-1 scale next to every importance config field
- Validate external config (YAML/CLI) with range checks before constructing the dataclass
- Convert percent-style inputs at the boundary: value / 100.0
When it happens
Trigger: MemoryBridgeConfig(default_importance=5), default_importance=-0.1, or a value parsed from YAML/CLI as a string like 'high' that coerces unexpectedly; the dataclass __post_init__ runs immediately on construction.
Common situations: Copy-pasting a 1-10 importance scale from another tool; percentage (75) instead of fraction (0.75); config files shared between components with different ranges.
Related errors
- dedup_similarity_threshold must be 0.0-1.0, got {self.dedup_
- vector_dimension must be positive, got {self.vector_dimensio
- hnsw_ef_construction must be positive, got {self.hnsw_ef_con
- hnsw_m must be positive, got {self.hnsw_m}
- hnsw_ef_search must be positive, got {self.hnsw_ef_search}
AI-assisted analysis of headroomlabs-ai/headroom@322425c43b (2026-08-15).
Data as JSON: /api/errors/edba53cb2e73eb55.
Report an issue: GitHub.