{"record":{"id":"ffd407a9d79644e9","repo":"HKUDS/Vibe-Trading","slug":"vintage-year-self-vintage-year-r-is-outside-the","errorCode":null,"errorMessage":"vintage_year={self.vintage_year!r} is outside the plausible range 1800-2200","messagePattern":"vintage_year=(.+?) is outside the plausible range 1800-2200","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"agent/src/entities/models.py","lineNumber":308,"sourceCode":"\n    def __post_init__(self) -> None:\n        \"\"\"Validate the base fields plus fund-specific ranges.\n\n        Raises:\n            ValueError: If ``structure`` is unknown, ``commitment`` is\n                negative, ``management_fee_rate`` is out of ``[0, 1]``, or\n                ``vintage_year`` is implausible.\n        \"\"\"\n        super().__post_init__()\n        try:\n            object.__setattr__(self, \"structure\", FundStructure(self.structure))\n        except ValueError as exc:\n            valid = \", \".join(member.value for member in FundStructure)\n            raise ValueError(\n                f\"unknown structure {self.structure!r}; expected one of: {valid}\"\n            ) from exc\n        if self.vintage_year is not None and not 1800 <= int(self.vintage_year) <= 2200:\n            raise ValueError(\n                f\"vintage_year={self.vintage_year!r} is outside the plausible \"\n                \"range 1800-2200\"\n            )\n        if self.commitment is not None:\n            if float(self.commitment) < 0:\n                raise ValueError(\n                    f\"commitment must be non-negative (it is a size, not a signed \"\n                    f\"cash flow), got {self.commitment!r}\"\n                )\n            object.__setattr__(self, \"commitment\", float(self.commitment))\n        if self.management_fee_rate is not None:\n            rate = float(self.management_fee_rate)\n            if not 0.0 <= rate <= 1.0:\n                raise ValueError(\n                    f\"management_fee_rate must be a decimal fraction in [0, 1] \"\n                    f\"(0.02 means 2%), got {self.management_fee_rate!r}\"\n                )\n            object.__setattr__(self, \"management_fee_rate\", rate)","sourceCodeStart":290,"sourceCodeEnd":326,"githubUrl":"https://github.com/HKUDS/Vibe-Trading/blob/80ffdda44c5c4db0dd84d70e051cca591cea67df/agent/src/entities/models.py#L290-L326","documentation":"Fund.__post_init__ range-checks vintage_year, when provided, against 1800–2200 to catch unit and encoding errors (e.g. a year stored as 20,250 or 105). vintage_year may be None, but a non-None value outside the band is rejected.","triggerScenarios":"Fund(..., vintage_year=20250) (typo/extra digit), vintage_year=25 (two-digit year), or vintage_year=105 (Excel serial or misparsed date). The value is int()-coerced before comparison, so '2024' as a string is fine but 20240 is not.","commonSituations":"Importing from Excel where the year column was parsed as a full date serial or truncated; hand-typed data entry errors; years accidentally multiplied or concatenated (e.g. 20242025).","solutions":["Fix the source value to a plausible 4-digit year","If two-digit years appear, expand them: 2000 + yy for yy < 100 (with a cutoff heuristic)","Validate/clip vintage_year at ingest and flag outliers before constructing Fund objects"],"exampleFix":"# before\nFund(instrument_id='f1', vintage_year=20250)\n\n# after\nFund(instrument_id='f1', vintage_year=2025)","handlingStrategy":"validation","validationCode":"vy = row.get('vintage_year')\nif vy is not None:\n    vy = int(vy)\n    if not 1800 <= vy <= 2200:\n        raise ValueError(f'implausible vintage_year {vy} on row {row_id}')\nfund = Fund(..., vintage_year=vy)","typeGuard":"def is_plausible_vintage_year(y) -> bool:\n    return y is None or (isinstance(y, int) and 1800 <= y <= 2200)","tryCatchPattern":null,"preventionTips":["Check year magnitudes when loading from Excel (serials/truncation)","Expand two-digit years with an explicit cutoff rule","Profile year columns for outliers before bulk construction"],"tags":["python","dataclass","range-check","funds","year-validation"],"backgroundTag":"numeric-range-validation","analyzedSha":"80ffdda44c5c4db0dd84d70e051cca591cea67df","analyzedAt":"2026-08-28T12:46:38.989Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}