{"record":{"id":"c5eacdfb70bfe359","repo":"HKUDS/Vibe-Trading","slug":"model-name-is-required-and-cannot-be-blank-got","errorCode":null,"errorMessage":"{model}: name is required and cannot be blank, got {name!r}","messagePattern":"(.+?): name is required and cannot be blank, got (.+?)","errorType":"exception","errorClass":"ValuationError","httpStatus":null,"severity":"error","filePath":"agent/src/quantlib/valuation/comps.py","lineNumber":589,"sourceCode":"        )\n    equity = float(enterprise_value) - delta\n    return EVBridgeResult(\n        direction=\"ev_to_equity\",\n        equity_value=equity,\n        enterprise_value=float(enterprise_value),\n        total_debt=float(total_debt),\n        cash_and_equivalents=float(cash_and_equivalents),\n        minority_interest=minority_interest,\n        preferred_stock=preferred_stock,\n        investments_in_associates=investments_in_associates,\n        omitted_components=omitted,\n    )\n\n\ndef _require_name(name: str, model: str) -> str:\n    \"\"\"Reject a blank company name -- every report keys off it.\"\"\"\n    if not isinstance(name, str) or not name.strip():\n        raise ValuationError(f\"{model}: name is required and cannot be blank, got {name!r}\")\n    return name\n\n\ndef _require_eps_basis(eps_basis: str, model: str) -> str:\n    \"\"\"Reject an EPS basis that is not one of the two this module recognises.\"\"\"\n    if eps_basis not in EPS_BASES:\n        raise ValuationError(\n            f\"{model}: eps_basis must be one of {EPS_BASES}, got {eps_basis!r}\"\n        )\n    return eps_basis\n\n\n@dataclass(frozen=True)\nclass PeerCompany:\n    \"\"\"One comparable company's raw inputs for the EV bridge and multiple matrix.\n\n    Attributes:\n        name: Identifier (ticker or short name), used in every report and","sourceCodeStart":571,"sourceCodeEnd":607,"githubUrl":"https://github.com/HKUDS/Vibe-Trading/blob/80ffdda44c5c4db0dd84d70e051cca591cea67df/agent/src/quantlib/valuation/comps.py#L571-L607","documentation":"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.","triggerScenarios":"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.","commonSituations":"Programmatic peer construction from rows where the name column is empty; CSVs with missing ticker/name cells; default '' values leaking through.","solutions":["Validate the name field in your ingestion code before constructing the dataclass.","Provide a fallback identifier (ticker) with a documented basis when the display name is missing.","Fail fast on empty rows upstream: skip records with blank names and log them."],"exampleFix":"# before\npeer = CompPeer(name=row.get('name', ''), ...)\n\n# after\nname = (row.get('name') or row['ticker']).strip()\nif not name:\n    continue\npeer = CompPeer(name=name, ...)","handlingStrategy":"validation","validationCode":"name = (name or '').strip()\nif not name:\n    raise ValueError('company name required')","typeGuard":"def valid_name(name):\n    return isinstance(name, str) and bool(name.strip())","tryCatchPattern":"except ValuationError as e:\n    if 'name is required' in str(e):\n        skip_row()","preventionTips":["Skip blank-name rows during ingestion","Default names to ticker with a documented rule"],"tags":["valuation","required-field","blank-name","validation"],"backgroundTag":"required-field-missing","analyzedSha":"80ffdda44c5c4db0dd84d70e051cca591cea67df","analyzedAt":"2026-08-28T12:46:38.989Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}