Comfy-Org/ComfyUI · error · RuntimeError

Unexpected response: no base image returned.

Error message

Unexpected response: no base image returned.

What it means

Raised by ByteDanceSeedreamLayerSeparationNode when the completed response contains no usable first item: response.data is empty or its first element lacks a 'url'. The node expects the base (merged) image to be the first element of the result list, so an unexpected payload shape is treated as a hard failure.

Source

Thrown at comfy_api_nodes/nodes_bytedance.py:1255

                f"ByteDance request failed. Code: {response.error['code']}, message: {response.error['message']}"
            )

        def z_index_of(d: dict) -> int:
            v = d.get("z_index")
            if isinstance(v, bool):
                return 1_000_000
            if isinstance(v, (int, float)):
                return int(v)
            if isinstance(v, str):
                try:
                    return int(v.strip())
                except ValueError:
                    return 1_000_000
            return 1_000_000

        data = [d for d in (response.data or []) if isinstance(d, dict)]
        if not data or "url" not in data[0]:
            raise RuntimeError("Unexpected response: no base image returned.")
        base_item = data[0]
        if base_item.get("bounding_box") is not None:
            logging.warning(
                "ByteDance layer separation: base item unexpectedly carries a bounding_box; ignoring it."
            )
        if z_index_of(base_item) not in (0, 1_000_000):
            raise RuntimeError("Unexpected response: the first item is not the base image.")
        layer_items = [d for d in data[1:] if "url" in d]
        dropped = len(data) - 1 - len(layer_items)
        if dropped > 0:
            logging.warning(
                "ByteDance layer separation: %d of %d returned elements had no 'url' and were dropped.",
                dropped,
                len(data) - 1,
            )
        if not layer_items:
            raise RuntimeError("The model returned no layers. Try a different prompt or input image.")
        layer_items.sort(key=z_index_of)

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Retry the request — malformed payloads are often transient.
  2. Update ComfyUI/comfy_api_nodes to the latest version in case the response parser was adapted to a new payload shape.
  3. Report the issue with ComfyUI/temp/api_logs/ content if it reproduces consistently.
Defensive patterns

Strategy: retry

Try / catch

for attempt in range(3):
    try:
        return await separate_layers(image)
    except RuntimeError as e:
        if 'no base image returned' in str(e) and attempt < 2:
            await asyncio.sleep(2 ** attempt)
            continue
        raise

Prevention

When it happens

Trigger: The API returns data=[] or a first element without a 'url' key — a malformed/unexpected response contract rather than a generation error (those surface via response.error).

Common situations: Upstream API contract change or A/B behavior on BytePlus side; the model returning only layer items without the base image; transient malformed payload.

Related errors


AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14). Data as JSON: /api/errors/c89a878f65269f81. Report an issue: GitHub.