{"record":{"id":"6199670361fcd8b6","repo":"HKUDS/Vibe-Trading","slug":"interval-is-too-large-expected-at-most-15-digits","errorCode":null,"errorMessage":"interval is too large; expected at most 15 digits of milliseconds","messagePattern":"interval is too large; expected at most 15 digits of milliseconds","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"agent/src/scheduled_research/models.py","lineNumber":132,"sourceCode":"\ndef validate_schedule(schedule: str) -> None:\n    \"\"\"Raise ``ValueError`` when *schedule* is malformed.\n\n    Args:\n        schedule: Either a positive integer string (interval-ms) or a\n            simplified 5-field cron expression.\n\n    Raises:\n        ValueError: When the schedule does not match either accepted form.\n    \"\"\"\n    if not schedule or not isinstance(schedule, str):\n        raise ValueError(\"schedule must be a non-empty string\")\n\n    if _INTERVAL_MS_RE.fullmatch(schedule.strip()):\n        # 15 digits ≈ 31,000 years in milliseconds — anything longer is not a\n        # usable interval and would only feed int() conversion of huge strings.\n        if len(schedule.strip()) > 15:\n            raise ValueError(\"interval is too large; expected at most 15 digits of milliseconds\")\n        return  # valid interval\n\n    parts = schedule.strip().split()\n    if len(parts) != _CRON_PARTS:\n        raise ValueError(f\"schedule must be a positive integer (ms) or a 5-field cron string; got: {schedule!r}\")\n    for part, (low, high) in zip(parts, CRON_BOUNDS):\n        _validate_cron_field(part, low, high)\n\n\ndef validate_timezone_shape(tz: Optional[str]) -> None:\n    \"\"\"Raise ``ValueError`` when *tz* is not ``None`` or a non-empty string.\n\n    This is the persistence-level check: it deliberately does NOT resolve the\n    key, because resolvability depends on the host's timezone database. A\n    store written where a key resolved must keep loading and persisting on a\n    host where it does not; the executor surfaces the unresolvable key as a\n    per-job schedule failure instead.\n    \"\"\"","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/HKUDS/Vibe-Trading/blob/80ffdda44c5c4db0dd84d70e051cca591cea67df/agent/src/scheduled_research/models.py#L114-L150","documentation":"When a schedule matches the pure-digit interval form (milliseconds), it is capped at 15 digits (~31,000 years). Longer digit strings would overflow practical timing arithmetic and int conversion of huge strings, so they are rejected rather than silently accepted.","triggerScenarios":"validate_schedule('9999999999999999') (16 digits), a schedule built by multiplying milliseconds by an inflated factor, or a copy-pasted nanosecond value (18-19 digits).","commonSituations":"Unit confusion: passing nanoseconds or microseconds where milliseconds are expected; computing intervals from misparsed large numbers (e.g. ms*days*1000 applied twice).","solutions":["Cap intervals to at most 15 digits of milliseconds; for anything longer just use cron or a very large but sane value.","Verify the unit is milliseconds: 3600000 = 1 hour.","If you meant a daily/weekly schedule, prefer a cron string over a giant interval."],"exampleFix":"# before\nvalidate_schedule('3600000000000000000')  # ns, not ms\n# after\nvalidate_schedule('3600000')  # 1 hour in ms","handlingStrategy":"validation","validationCode":"if schedule.strip().isdigit() and len(schedule.strip()) > 15:\n    raise ValueError('interval too large; use a cron schedule instead')\nvalidate_schedule(schedule)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Confirm the unit is milliseconds (3600000 = 1 hour).","Use cron for daily/weekly schedules instead of giant intervals."],"tags":["python","cron","validation","scheduler","unit-confusion"],"backgroundTag":"cron-expression-invalid","analyzedSha":"80ffdda44c5c4db0dd84d70e051cca591cea67df","analyzedAt":"2026-08-28T12:46:38.989Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}