HKUDS/Vibe-Trading · error · ValuationError

{model}: name is required and cannot be blank, got {name!r}

Error message

{model}: name is required and cannot be blank, got {name!r}

What it means

Company dataclasses (_require_name, invoked from __post_init__) reject blank or non-string names because every report and deduplication step keys off the company name. Constructing a peer/target with name='' or ' ' (or a non-str) fails immediately at object construction.

Source

Thrown at agent/src/quantlib/valuation/comps.py:589

        )
    equity = float(enterprise_value) - delta
    return EVBridgeResult(
        direction="ev_to_equity",
        equity_value=equity,
        enterprise_value=float(enterprise_value),
        total_debt=float(total_debt),
        cash_and_equivalents=float(cash_and_equivalents),
        minority_interest=minority_interest,
        preferred_stock=preferred_stock,
        investments_in_associates=investments_in_associates,
        omitted_components=omitted,
    )


def _require_name(name: str, model: str) -> str:
    """Reject a blank company name -- every report keys off it."""
    if not isinstance(name, str) or not name.strip():
        raise ValuationError(f"{model}: name is required and cannot be blank, got {name!r}")
    return name


def _require_eps_basis(eps_basis: str, model: str) -> str:
    """Reject an EPS basis that is not one of the two this module recognises."""
    if eps_basis not in EPS_BASES:
        raise ValuationError(
            f"{model}: eps_basis must be one of {EPS_BASES}, got {eps_basis!r}"
        )
    return eps_basis


@dataclass(frozen=True)
class PeerCompany:
    """One comparable company's raw inputs for the EV bridge and multiple matrix.

    Attributes:
        name: Identifier (ticker or short name), used in every report and

View on GitHub (pinned to 80ffdda44c)

Solutions

  1. Validate the name field in your ingestion code before constructing the dataclass.
  2. Provide a fallback identifier (ticker) with a documented basis when the display name is missing.
  3. Fail fast on empty rows upstream: skip records with blank names and log them.

Example fix

# before
peer = CompPeer(name=row.get('name', ''), ...)

# after
name = (row.get('name') or row['ticker']).strip()
if not name:
    continue
peer = CompPeer(name=name, ...)
Defensive patterns

Strategy: validation

Validate before calling

name = (name or '').strip()
if not name:
    raise ValueError('company name required')

Type guard

def valid_name(name):
    return isinstance(name, str) and bool(name.strip())

Try / catch

except ValuationError as e:
    if 'name is required' in str(e):
        skip_row()

Prevention

When it happens

Trigger: Building a comps peer or target dataclass with an empty/whitespace name, or a name that is None/int because a dict key was missed.

Common situations: Programmatic peer construction from rows where the name column is empty; CSVs with missing ticker/name cells; default '' values leaking through.

Related errors


AI-assisted analysis of HKUDS/Vibe-Trading@80ffdda44c (2026-08-28). Data as JSON: /api/errors/c5eacdfb70bfe359. Report an issue: GitHub.