{"record":{"id":"465570002796643c","repo":"Lightning-AI/pytorch-lightning","slug":"unsupported-parameter-value-timer-interval-inter","errorCode":null,"errorMessage":"Unsupported parameter value `Timer(interval={interval})`. Possible choices are: {', '.join(set(Interval))}","messagePattern":"Unsupported parameter value `Timer\\(interval=(.+?)\\)`\\. Possible choices are: (.+?)","errorType":"exception","errorClass":"MisconfigurationException","httpStatus":null,"severity":"error","filePath":"src/lightning/pytorch/callbacks/timer.py","lineNumber":107,"sourceCode":"    ) -> None:\n        super().__init__()\n        if isinstance(duration, str):\n            duration_match = re.fullmatch(r\"(\\d+):(\\d\\d):(\\d\\d):(\\d\\d)\", duration.strip())\n            if not duration_match:\n                raise MisconfigurationException(\n                    f\"`Timer(duration={duration!r})` is not a valid duration. \"\n                    \"Expected a string in the format DD:HH:MM:SS.\"\n                )\n            duration = timedelta(\n                days=int(duration_match.group(1)),\n                hours=int(duration_match.group(2)),\n                minutes=int(duration_match.group(3)),\n                seconds=int(duration_match.group(4)),\n            )\n        elif isinstance(duration, dict):\n            duration = timedelta(**duration)\n        if interval not in set(Interval):\n            raise MisconfigurationException(\n                f\"Unsupported parameter value `Timer(interval={interval})`. Possible choices are:\"\n                f\" {', '.join(set(Interval))}\"\n            )\n        self._duration = duration.total_seconds() if duration is not None else None\n        self._interval = interval\n        self._verbose = verbose\n        self._start_time: dict[RunningStage, Optional[float]] = dict.fromkeys(RunningStage)\n        self._end_time: dict[RunningStage, Optional[float]] = dict.fromkeys(RunningStage)\n        self._offset = 0\n\n    def start_time(self, stage: str = RunningStage.TRAINING) -> Optional[float]:\n        \"\"\"Return the start time of a particular stage (in seconds)\"\"\"\n        stage = RunningStage(stage)\n        return self._start_time[stage]\n\n    def end_time(self, stage: str = RunningStage.TRAINING) -> Optional[float]:\n        \"\"\"Return the end time of a particular stage (in seconds)\"\"\"\n        stage = RunningStage(stage)","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/Lightning-AI/pytorch-lightning/blob/9fed5c27d2a62ff0efd6c3573599921d6ff67c14/src/lightning/pytorch/callbacks/timer.py#L89-L125","documentation":"Timer's `interval` argument determines when the time budget is checked (on epoch end vs step end) and must be one of the Interval enum values ('epoch' or 'step'). Any other string or type raises this MisconfigurationException in __init__.","triggerScenarios":"Timer(interval='batch'), Timer(interval='epochs'), Timer(interval=1), or a typo like 'Step'.","commonSituations":"Assuming 'batch' is valid because steps are batches; case sensitivity surprises.","solutions":["Use interval='epoch' or interval='step' (from lightning.pytorch.callbacks.timer.timer.Interval)","Check valid values: from lightning.pytorch.callbacks.timer import Interval; print(set(Interval))"],"exampleFix":"# before\ntimer = Timer(duration=\"00:00:10:00\", interval=\"batch\")\n# after\nfrom lightning.pytorch.callbacks.timer import Interval\ntimer = Timer(duration=\"00:00:10:00\", interval=Interval.step)  # or \"step\"","handlingStrategy":"validation","validationCode":"from lightning.pytorch.callbacks.timer import Interval\ndef norm_interval(v):\n    v = str(v).lower()\n    assert v in set(Interval), f'interval must be one of {set(Interval)}'\n    return v\nTimer(interval=norm_interval(cfg.interval))","typeGuard":"def is_valid_interval(v) -> bool:\n    from lightning.pytorch.callbacks.timer import Interval\n    return v in set(Interval)","tryCatchPattern":null,"preventionTips":["Import and use the Interval enum instead of raw strings","Lowercase user input before passing to Timer"],"tags":["timer","interval","enum-validation","callback"],"backgroundTag":"invalid-enum-value","analyzedSha":"9fed5c27d2a62ff0efd6c3573599921d6ff67c14","analyzedAt":"2026-08-28T11:52:41.083Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}