calesthio/OpenMontage · error · RuntimeError

Ark query returned a non-object response

Error message

Ark query returned a non-object response

What it means

RuntimeError raised in _query_task when response.json() decodes successfully but is not a JSON object (dict) — e.g. the endpoint returned a JSON array, string, or number. The task query contract requires an object; anything else means the response shape is unusable and the client refuses to guess at fields.

Source

Thrown at tools/video/seedance_ark.py:1294

                    timeout=30,
                )
                retryable_status = (
                    response.status_code == 429 or response.status_code >= 500
                )
                if retryable_status and attempt < self.retry_policy.max_retries:
                    time.sleep(self.retry_policy.backoff_seconds * (2**attempt))
                    continue
                self._raise_for_status(response)
                break
            except requests.RequestException:
                if attempt >= self.retry_policy.max_retries:
                    raise
                time.sleep(self.retry_policy.backoff_seconds * (2**attempt))
        if response is None:
            raise RuntimeError("Ark query returned no response")
        data = response.json()
        if not isinstance(data, dict):
            raise RuntimeError("Ark query returned a non-object response")
        return data

    def _cancel_task(self, task_id: str, api_key: str) -> None:
        import requests

        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],

View on GitHub (pinned to 95e1c3d0ab)

Solutions

  1. Verify _get_base_url() points at the correct Ark endpoint for your region/environment.
  2. Inspect the raw response body (log response.text) to see what JSON shape is actually returned and by whom.
  3. If a proxy is in the path (HTTP_PROXY/HTTPS_PROXY), bypass it for the Ark host and retest.
  4. Check for an SDK/version mismatch: ensure the client's expected API version matches the deployed Ark API.
Defensive patterns

Strategy: try-catch

Validate before calling

from urllib.parse import urlparse
host = urlparse(tool._get_base_url()).hostname
assert "ark" in host or "volces" in host, f"suspicious base url: {host}"

Try / catch

try:
    data = tool._query_task(task_id, api_key)
except RuntimeError as e:
    if "non-object" in str(e):
        logger.error("Ark API shape changed; dumping raw body for diagnosis")
        raise

Prevention

When it happens

Trigger: An intermediate proxy or gateway returning a bare JSON array/string, a redirected response from an auth wall serving JSON like "unauthorized", or an API change where the task endpoint wraps objects in a list. Note: malformed JSON would raise requests.JSONDecodeError instead — this error is specifically valid-JSON-wrong-shape.

Common situations: Corporate proxies rewriting responses, base-URL misconfiguration pointing at a different Ark service version, or HTML-to-JSON content transformation by a CDN edge.

Related errors


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