HKUDS/Vibe-Trading · error · ValueError
unknown hypothesis status '{status}'. Allowed: {allowed}
Error message
unknown hypothesis status '{status}'. Allowed: {allowed} What it means
Raised by HypothesisRegistry when a hypothesis status string does not normalize (strip+lowercase) to one of the allowed HYPOTHESIS_STATUSES values. It is a whitelist validation on an enum-like field enforced at every entry point that touches status (from_dict, create, update, search).
Source
Thrown at agent/src/hypotheses/registry.py:78
return set(_TOKEN_RE.findall(text.lower()))
def _new_hypothesis_id(title: str, created_at: str, existing_ids: set[str]) -> str:
seed = f"{title.strip().lower()}|{created_at}"
base = "hyp_" + hashlib.sha256(seed.encode("utf-8")).hexdigest()[:12]
if base not in existing_ids:
return base
idx = 2
while f"{base}_{idx}" in existing_ids:
idx += 1
return f"{base}_{idx}"
def _validate_status(status: str) -> str:
normalized = str(status).strip().lower()
if normalized not in _STATUS_SET:
allowed = ", ".join(HYPOTHESIS_STATUSES)
raise ValueError(f"unknown hypothesis status '{status}'. Allowed: {allowed}")
return normalized
@dataclass
class Hypothesis:
"""A research hypothesis tracked across analysis and backtests.
Attributes:
hypothesis_id: Stable registry identifier.
title: Short human-readable title.
thesis: Research thesis or rationale.
status: Lifecycle status.
universe: Target universe, market, or asset set.
signal_definition: Signal logic in plain text.
data_sources: Data sources expected or used.
skills: Relevant Vibe-Trading skills.
run_cards: Linked backtest/run-card artifacts.
invalidation_notes: Notes describing rejection or invalidation logic.View on GitHub (pinned to 80ffdda44c)
Solutions
- Check the allowed list in the error message and correct the status string (values come from HYPOTHESIS_STATUSES, e.g. active/validated/invalidated)
- Normalize before calling: status.strip().lower()
- If introducing a new status, add it to HYPOTHESIS_STATUSES in agent/src/hypotheses/registry.py and migrate stored records
Example fix
# before registry.update(hid, status="Archieved") # after registry.update(hid, status="archived")
Defensive patterns
Strategy: validation
Validate before calling
from agent.src.hypotheses.registry import HYPOTHESIS_STATUSES
status = (status or '').strip().lower()
if status not in HYPOTHESIS_STATUSES:
raise ValueError(f'pick one of {sorted(HYPOTHESIS_STATUSES)}') Type guard
def is_valid_status(s: str) -> bool:
return isinstance(s, str) and s.strip().lower() in HYPOTHESIS_STATUSES Try / catch
try:
registry.update(hid, status=status)
except ValueError as exc:
if 'unknown hypothesis status' in str(exc):
status = 'active' # fallback; surface to user in UI code Prevention
- Normalize status strings with .strip().lower() before passing them in
- Expose HYPOTHESIS_STATUSES as the source of truth in UI dropdowns
- Validate API payloads against the status whitelist at the boundary
When it happens
Trigger: Calling registry.create(..., status='archieve'), update(id, status='dropped'), Hypothesis.from_dict({'status': 'Active '}) with a typo/case-mismatch, or search(status='bogus') where the string is not in the allowed status set after lowercasing.
Common situations: Hand-editing the hypotheses JSON storage with a wrong status, upgrading code where new statuses were added but stale data uses old names, or passing an unvalidated UI/API value straight into the registry.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- memory_type must be one of: {', '.join(MEMORY_TYPES)}
- invalid regime {self.regime!r}; expected one of {REGIMES}
- invalid evidence_stage {self.evidence_stage!r}; expected one
- flow_timing must be {FLOW_TIMING_END!r} or {FLOW_TIMING_STAR
- invalid alpha_id
AI-assisted analysis of HKUDS/Vibe-Trading@80ffdda44c (2026-08-28).
Data as JSON: /api/errors/bd375a7fd9b57bef.
Report an issue: GitHub.