HKUDS/Vibe-Trading · error · ValueError
an assumption must be named
Error message
an assumption must be named
What it means
The Assumption dataclass requires a non-blank name in __post_init__. Assumptions are first-class justified values in this package, so an anonymous assumption cannot be referenced or audited and is rejected at construction.
Source
Thrown at agent/src/quantlib/valuation/contracts.py:99
basis: Why this value. Free text, but required and non-empty: an
assumption whose justification nobody wrote down cannot be reviewed,
and an unreviewable assumption in a valuation is indistinguishable
from a guess.
source: Optional pointer to where the basis came from -- a filing, a
data tool call, a named analyst view.
Raises:
ValueError: If ``name`` or ``basis`` is empty or blank.
"""
name: str
value: Any
basis: str
source: str | None = None
def __post_init__(self) -> None:
if not str(self.name).strip():
raise ValueError("an assumption must be named")
if not str(self.basis).strip():
raise ValueError(
f"assumption {self.name!r} has no basis; state why this value was "
"chosen, or do not make the assumption"
)
def require_inputs(
supplied: Mapping[str, Any],
required: Iterable[str],
model: str,
) -> None:
"""Refuse to run unless every required input is present and usable.
A key that is absent, ``None``, or an empty string counts as missing. Zero
and ``False`` do NOT: they are legitimate values for a line item, and
treating them as missing is the mirror-image bug of defaulting.
View on GitHub (pinned to 80ffdda44c)
Solutions
- Ensure every assumption dict has a meaningful non-empty name before construction.
- Validate config: assert each key is non-blank before building Assumptions from it.
- Use descriptive snake_case names like 'terminal_growth_rate' so name checks also catch swapped-key bugs.
Example fix
# before Assumption(name='', value=0.025, basis='proxy for LT GDP growth') # after Assumption(name='terminal_growth_rate', value=0.025, basis='proxy for LT GDP growth')
Defensive patterns
Strategy: validation
Validate before calling
if not str(name or '').strip():
raise ValueError('assumption name required') Type guard
def valid_assumption_name(n):
return bool(str(n or '').strip()) Prevention
- Validate assumption config entries have non-empty name keys
- Use descriptive parameter-matching names
When it happens
Trigger: Constructing Assumption(name='', value=0.02, basis='...') or Assumption(name=' ', ...); usually a dict unpacking where the name key is missing/empty.
Common situations: Building assumptions in a loop from config entries where one lacks a 'name' key; whitespace-only names from templated strings; refactor renaming keys but not the constructor call.
Related errors
- {model}: name is required and cannot be blank, got {name!r}
- assumption {self.name!r} has no basis; state why this value
- title is required
- thesis is required
- memory name must not be empty or whitespace-only
AI-assisted analysis of HKUDS/Vibe-Trading@80ffdda44c (2026-08-28).
Data as JSON: /api/errors/de24a403a1d43adf.
Report an issue: GitHub.