{"record":{"id":"3c82a5cab352fd7e","repo":"HKUDS/Vibe-Trading","slug":"peers","errorCode":null,"errorMessage":"peers","messagePattern":"peers","errorType":"exception","errorClass":"MissingInputError","httpStatus":null,"severity":"error","filePath":"agent/src/quantlib/valuation/comps.py","lineNumber":1174,"sourceCode":"            the peers themselves were not missing, only their multiples were\n            not computable.\n        ValuationError: If `calendarisation_policy` is not recognised, if\n            two peers share a name, or if peers/target do not all declare\n            the same `eps_basis` (mixing GAAP and adjusted EPS across the\n            comp set would skew the P/E distribution by whatever one-time\n            items the adjustment removes, the same kind of silent distortion\n            the calendarisation-policy rule exists to prevent).\n        MissingInputError: (propagated from `calendarise_metric`) if any\n            peer's or the target's fiscal-period data lacks a field\n            `calendarisation_policy` needs.\n    \"\"\"\n    if calendarisation_policy not in CALENDARISATION_POLICIES:\n        raise ValuationError(\n            f\"comps.run_comps: unknown calendarisation_policy {calendarisation_policy!r}, \"\n            f\"must be one of {CALENDARISATION_POLICIES}\"\n        )\n    if len(peers) == 0:\n        raise MissingInputError((\"peers\",), \"comps.run_comps\")\n\n    names = [peer.name for peer in peers]\n    if len(set(names)) != len(names):\n        raise ValuationError(f\"comps.run_comps: duplicate peer names in {names}\")\n\n    all_bases = {peer.eps_basis for peer in peers} | {target.eps_basis}\n    if len(all_bases) > 1:\n        raise ValuationError(\n            \"comps.run_comps: mixed eps_basis across the comp set \"\n            f\"{sorted(all_bases)} -- every peer and the target must declare the \"\n            \"same EPS basis, or the P/E distribution mixes GAAP and adjusted \"\n            \"earnings\"\n        )\n\n    peer_multiples = tuple(peer_multiple_set(peer, calendarisation_policy) for peer in peers)\n    distributions = {\n        name: multiple_distribution(name, peer_multiples) for name in MULTIPLE_NAMES\n    }","sourceCodeStart":1156,"sourceCodeEnd":1192,"githubUrl":"https://github.com/HKUDS/Vibe-Trading/blob/80ffdda44c5c4db0dd84d70e051cca591cea67df/agent/src/quantlib/valuation/comps.py#L1156-L1192","documentation":"run_comps raises MissingInputError(('peers',), 'comps.run_comps') when the peers sequence is empty — a comp analysis with no comparables has no statistics to compute, which is treated as a missing input rather than a numeric error.","triggerScenarios":"Calling run_comps(target, peers=[]) or peers=() — e.g. a screening filter excluded every candidate peer before the call.","commonSituations":"Over-aggressive peer filters (liquidity, listing exchange, negative-EBITDA exclusion) emptying the peer set; upstream data fetch returning zero rows; empty watchlist in config.","solutions":["Check len(peers) before calling and surface a domain-level 'no comparables matched' message.","Loosen or review the screening filters that produced the empty set.","Fetch/validate peer data earlier so an empty universe is caught at data-load time."],"exampleFix":"# before\nresult = run_comps(target, peers=filtered_peers)\n\n# after\nif not filtered_peers:\n    raise ValueError('no peers survived screening; widen filters')\nresult = run_comps(target, peers=filtered_peers)","handlingStrategy":"validation","validationCode":"if not peers:\n    raise ValueError('no comparable peers available after screening')","typeGuard":"def has_peers(peers):\n    return len(peers) > 0","tryCatchPattern":"from quantlib.valuation.contracts import MissingInputError\ntry:\n    run_comps(target, peers)\nexcept MissingInputError as e:\n    if 'peers' in e.missing:\n        return build_empty_report(reason='no peers')","preventionTips":["Check peer-set size after screening steps","Surface 'no comparables matched' as a domain message, not a crash"],"tags":["valuation","missing-input","empty-list","comps"],"backgroundTag":"empty-required-collection","analyzedSha":"80ffdda44c5c4db0dd84d70e051cca591cea67df","analyzedAt":"2026-08-28T12:46:38.989Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}