Comfy-Org/ComfyUI · error · RuntimeError
The model returned no layers. Try a different prompt or inpu
Error message
The model returned no layers. Try a different prompt or input image.
What it means
Raised by ByteDanceSeedreamLayerSeparationNode when the response contained a base image but zero layer items with a 'url' (entries without URLs are already dropped with a warning before this check). The generation technically ran but produced no separable layers for this input.
Source
Thrown at comfy_api_nodes/nodes_bytedance.py:1272
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)
base_image = (await download_url_to_image_tensor(str(base_item["url"])))[..., :3].contiguous()
height, width = base_image.shape[1], base_image.shape[2]
specs = []
for item in layer_items:
flags = []
bbox = item.get("bounding_box")
absolute = bbox.get("absolute") if isinstance(bbox, dict) else None
if (
isinstance(absolute, (list, tuple))
and len(absolute) == 4
and all(isinstance(v, (int, float)) and not isinstance(v, bool) for v in absolute)
):
left, top, right, bottom = (int(round(v)) for v in absolute)
rect_w, rect_h = right - left, bottom - top # exclusive right/bottom
if rect_w > width or rect_h > height:View on GitHub (pinned to 1c6d8d45b3)
Solutions
- Try a different input image with clearly separated objects and a clean background.
- Adjust the prompt to describe the layer decomposition you want.
- Ensure the input meets the node's constraints (>=512px, aspect ratio within 1:16..16:1).
- Note the run was still billed; check api_logs if you believe it is a server fault.
Defensive patterns
Strategy: validation
Validate before calling
# pre-check the cheap local constraints before paying for a run assert get_number_of_images(image) == 1 assert image.shape[2] >= 512 and image.shape[1] >= 512 # min dims # then choose an image with clearly separable objects; no code can guarantee layers
Try / catch
try:
base, layers = await separate_layers(image)
except RuntimeError as e:
if 'no layers' in str(e):
base, layers = await separate_layers(enhance_contrast(image)) # different input
else:
raise Prevention
- Use images with distinct foreground objects on a clean background.
- Expect billing even when zero layers come back; validate inputs first.
When it happens
Trigger: Passing an image the model cannot decompose (flat single-object background, heavily compressed input, abstract noise) or an empty/irrelevant prompt for the layer task.
Common situations: Using low-contrast or texture-only images; images where no distinct foreground objects exist; prompts that describe new content instead of guiding separation.
Related errors
- Only a single input image is supported.
- Unexpected response: no base image returned.
- Unexpected response: the first item is not the base image.
- Failed to download layer {i + 1} of {len(specs)} (name={item
- Only {len(urls)} of {len(response.data)} images were generat
AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14).
Data as JSON: /api/errors/def35b45aae9623f.
Report an issue: GitHub.