{"record":{"id":"ad36ffe3d6792d64","repo":"calesthio/OpenMontage","slug":"poll-interval-seconds-must-be-between-0-and-60","errorCode":null,"errorMessage":"poll_interval_seconds must be between 0 and 60","messagePattern":"poll_interval_seconds must be between 0 and 60","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"tools/video/seedance_ark.py","lineNumber":1317,"sourceCode":"\n        response = requests.delete(\n            f\"{self._get_base_url()}/contents/generations/tasks/{task_id}\",\n            headers=self._headers(api_key),\n            timeout=30,\n        )\n        # The official DELETE success body is undefined and may be empty.\n        self._raise_for_status(response)\n\n    def _poll_task(\n        self,\n        task_id: str,\n        api_key: str,\n        inputs: dict[str, Any],\n    ) -> dict[str, Any]:\n        interval = float(inputs.get(\"poll_interval_seconds\", 3))\n        timeout = float(inputs.get(\"timeout_seconds\", 1200))\n        if not 0 <= interval <= 60:\n            raise ValueError(\"poll_interval_seconds must be between 0 and 60\")\n        if timeout <= 0:\n            raise ValueError(\"timeout_seconds must be greater than 0\")\n        deadline = time.monotonic() + timeout\n        while True:\n            task = self._query_task(task_id, api_key)\n            status = str(task.get(\"status\", \"\")).lower()\n            if status in self.TERMINAL_STATUSES:\n                return task\n            if status not in {\"queued\", \"running\"}:\n                raise RuntimeError(\n                    f\"Ark returned unknown task status: {status or '<empty>'}\"\n                )\n            if time.monotonic() >= deadline:\n                raise TimeoutError(\n                    f\"Ark task {task_id} did not finish within {timeout}s\"\n                )\n            time.sleep(interval)\n","sourceCodeStart":1299,"sourceCodeEnd":1335,"githubUrl":"https://github.com/calesthio/OpenMontage/blob/95e1c3d0ab93482159818560f6a8c8e866b9139f/tools/video/seedance_ark.py#L1299-L1335","documentation":"ValueError raised in _poll_task when the optional poll_interval_seconds input is outside [0, 60]. The tool polls the Ark task endpoint on this cadence while waiting for video generation; the guard prevents both busy-looping (interval 0 with no upper usefulness beyond it) and pathological multi-minute gaps, and it is checked before any polling starts.","triggerScenarios":"Passing poll_interval_seconds=0.01 (effectively a DoS on the query endpoint), poll_interval_seconds=120, a negative value, or a string that float() parses out of range. Note interval exactly 0 or exactly 60 is allowed.","commonSituations":"Developers tuning latency down to 'poll as fast as possible', or copying timeout_seconds values into poll_interval_seconds by mistake; agents generating config where the two keys get swapped.","solutions":["Use the default (3 seconds) unless you have a specific reason to change it.","For faster feedback use 1-2 seconds; for long batch jobs use 10-30 seconds — never above 60.","Double-check you did not swap poll_interval_seconds and timeout_seconds in the inputs dict."],"exampleFix":"# before\ninputs = {\"poll_interval_seconds\": 0.05, \"timeout_seconds\": 600}\n\n# after\ninputs = {\"poll_interval_seconds\": 2, \"timeout_seconds\": 600}","handlingStrategy":"validation","validationCode":"interval = float(inputs.get(\"poll_interval_seconds\", 3))\ninputs[\"poll_interval_seconds\"] = min(60.0, max(0.0, interval))","typeGuard":"def is_valid_poll_interval(v) -> bool:\n    try:\n        return 0 <= float(v) <= 60\n    except (TypeError, ValueError):\n        return False","tryCatchPattern":null,"preventionTips":["Keep poll_interval_seconds and timeout_seconds in adjacent, clearly named config keys to avoid swaps.","Default to 3s; only lower it for latency-critical single jobs."],"tags":["validation","seedance","ark","polling"],"backgroundTag":null,"analyzedSha":"95e1c3d0ab93482159818560f6a8c8e866b9139f","analyzedAt":"2026-08-15T06:31:20.014Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}