calesthio/OpenMontage · error · AtlasError

Prediction {prediction_id} did not finish within {timeout:.0

Error message

Prediction {prediction_id} did not finish within {timeout:.0f}s (last status: {last_status}). The job may still complete — check {PREDICTION_ENDPOINT}/{prediction_id}

What it means

Raised by poll when the timeout budget (default 600s) expires while the prediction is still in a non-terminal status. Distinct from a failure: the job may still complete on Atlas's side, so the message includes the direct prediction URL for later inspection. The last observed status is reported to distinguish a stuck queue from active processing.

Source

Thrown at tools/atlas_client.py:180

        consecutive_transport_errors = 0
        data = _payload_of(response)
        last_status = str(data.get("status", "unknown")).lower()

        if last_status in TERMINAL_SUCCESS:
            outputs = data.get("outputs") or []
            if not outputs:
                raise AtlasError(
                    f"Prediction {prediction_id} reported '{last_status}' but returned no outputs."
                )
            return data
        if last_status in TERMINAL_FAILURE:
            error = data.get("error") or "no error detail provided"
            raise AtlasError(f"Atlas Cloud generation failed ({last_status}): {error}")

        time.sleep(interval)
        elapsed += interval

    raise AtlasError(
        f"Prediction {prediction_id} did not finish within {timeout:.0f}s "
        f"(last status: {last_status}). The job may still complete — "
        f"check {PREDICTION_ENDPOINT}/{prediction_id}"
    )


def upload_media(file_path: str | Path, api_key: str, timeout: int = 120) -> str:
    """Upload a local file and return the hosted URL Atlas assigns to it.

    Used to turn a local reference image into the `image_url` that image-to-video
    models expect. Atlas has answered this endpoint with both {"data":
    {"download_url": ...}} and a bare {"url": ...}, so both shapes are accepted.
    """
    import requests

    path = Path(file_path)
    if not path.exists():
        raise AtlasError(f"Cannot upload — file not found: {path}")

View on GitHub (pinned to 95e1c3d0ab)

Solutions

  1. Increase the timeout argument to match the model's realistic render time (video: 15-30 minutes)
  2. Check the included prediction URL — if it later shows succeeded, fetch outputs directly instead of resubmitting and paying twice
  3. Reduce concurrent submissions so your jobs leave the queue faster
  4. For repeated runs, record typical completion times per model and set timeout to 2-3x that

Example fix

// before
data = atlas_client.poll(pid, api_key)

// after
data = atlas_client.poll(pid, api_key, timeout=1800.0, interval=5.0)
Defensive patterns

Strategy: retry

Validate before calling

expected_render_seconds = {"video-high": 1200, "image": 120}  # per-model baselines
timeout = expected_render_seconds.get(model_key, 600) * 1.5

Try / catch

try:
    data = atlas_client.poll(pid, api_key, timeout=timeout)
except AtlasError as e:
    if "did not finish within" in str(e):
        # job may still complete — re-poll the SAME id with a fresh budget
        data = atlas_client.poll(pid, api_key, timeout=900.0)
    else:
        raise

Prevention

When it happens

Trigger: Long video generations (30s clips at high resolution) exceeding the 600s default; Atlas queue congestion leaving jobs PENDING for extended periods; polling with a large interval so the timeout is hit by a few sleepy iterations while the job is nearly done.

Common situations: Premium video models routinely taking 10-20 minutes with default settings; batch submissions saturating the user's concurrency slot so jobs sit queued; timeouts set based on image-generation expectations applied to video.

Understand the failure class

Related errors


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