calesthio/OpenMontage · error · ValueError

timeout_seconds must be greater than 0

Error message

timeout_seconds must be greater than 0

What it means

ValueError raised in _poll_task when the optional timeout_seconds input is zero or negative. This value defines the monotonic deadline for how long the tool will keep polling the Ark task before giving up; a non-positive deadline is nonsensical and is rejected before the first query. Default is 1200 seconds.

Source

Thrown at tools/video/seedance_ark.py:1319

            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)

    @staticmethod
    def _download_video(video_url: str, output_path: Path) -> None:

View on GitHub (pinned to 95e1c3d0ab)

Solutions

  1. Pick a realistic positive timeout: Seedance generations typically need 60-1200 seconds depending on duration and resolution.
  2. If you intended 'wait forever', pass a large value like 3600 instead of 0.
  3. Omit the key to accept the 1200-second default.

Example fix

# before
inputs = {"timeout_seconds": 0}

# after
inputs = {"timeout_seconds": 1800}
Defensive patterns

Strategy: validation

Validate before calling

timeout = float(inputs.get("timeout_seconds", 1200))
if timeout <= 0:
    inputs["timeout_seconds"] = 1800  # never send 0 meaning 'infinite'

Type guard

def is_valid_poll_timeout(v) -> bool:
    try:
        return float(v) > 0
    except (TypeError, ValueError):
        return False

Prevention

When it happens

Trigger: Passing timeout_seconds=0 expecting 'no timeout' (the opposite happens), negative values, or unit confusion such as passing milliseconds (e.g. 500 meaning 500ms is fine, but 0 or -1 is not).

Common situations: Developers assuming 0 means infinite; config templating that substitutes an unset variable as 0; reusing a 'disabled' flag value (-1) from another system as the timeout.

Understand the failure class

Related errors


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