calesthio/OpenMontage · error · ValueError

poll_interval_seconds must be between 0 and 60

Error message

poll_interval_seconds must be between 0 and 60

What it means

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.

Source

Thrown at tools/video/seedance_ark.py:1317

        response = requests.delete(
            f"{self._get_base_url()}/contents/generations/tasks/{task_id}",
            headers=self._headers(api_key),
            timeout=30,
        )
        # The official DELETE success body is undefined and may be empty.
        self._raise_for_status(response)

    def _poll_task(
        self,
        task_id: str,
        api_key: str,
        inputs: dict[str, Any],
    ) -> dict[str, Any]:
        interval = float(inputs.get("poll_interval_seconds", 3))
        timeout = float(inputs.get("timeout_seconds", 1200))
        if not 0 <= interval <= 60:
            raise ValueError("poll_interval_seconds must be between 0 and 60")
        if timeout <= 0:
            raise ValueError("timeout_seconds must be greater than 0")
        deadline = time.monotonic() + timeout
        while True:
            task = self._query_task(task_id, api_key)
            status = str(task.get("status", "")).lower()
            if status in self.TERMINAL_STATUSES:
                return task
            if status not in {"queued", "running"}:
                raise RuntimeError(
                    f"Ark returned unknown task status: {status or '<empty>'}"
                )
            if time.monotonic() >= deadline:
                raise TimeoutError(
                    f"Ark task {task_id} did not finish within {timeout}s"
                )
            time.sleep(interval)

View on GitHub (pinned to 95e1c3d0ab)

Solutions

  1. Use the default (3 seconds) unless you have a specific reason to change it.
  2. For faster feedback use 1-2 seconds; for long batch jobs use 10-30 seconds — never above 60.
  3. Double-check you did not swap poll_interval_seconds and timeout_seconds in the inputs dict.

Example fix

# before
inputs = {"poll_interval_seconds": 0.05, "timeout_seconds": 600}

# after
inputs = {"poll_interval_seconds": 2, "timeout_seconds": 600}
Defensive patterns

Strategy: validation

Validate before calling

interval = float(inputs.get("poll_interval_seconds", 3))
inputs["poll_interval_seconds"] = min(60.0, max(0.0, interval))

Type guard

def is_valid_poll_interval(v) -> bool:
    try:
        return 0 <= float(v) <= 60
    except (TypeError, ValueError):
        return False

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of calesthio/OpenMontage@95e1c3d0ab (2026-08-15). Data as JSON: /api/errors/ad36ffe3d6792d64. Report an issue: GitHub.