{"record":{"id":"def35b45aae9623f","repo":"Comfy-Org/ComfyUI","slug":"the-model-returned-no-layers-try-a-different-prom","errorCode":null,"errorMessage":"The model returned no layers. Try a different prompt or input image.","messagePattern":"The model returned no layers\\. Try a different prompt or input image\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"comfy_api_nodes/nodes_bytedance.py","lineNumber":1272,"sourceCode":"        if not data or \"url\" not in data[0]:\n            raise RuntimeError(\"Unexpected response: no base image returned.\")\n        base_item = data[0]\n        if base_item.get(\"bounding_box\") is not None:\n            logging.warning(\n                \"ByteDance layer separation: base item unexpectedly carries a bounding_box; ignoring it.\"\n            )\n        if z_index_of(base_item) not in (0, 1_000_000):\n            raise RuntimeError(\"Unexpected response: the first item is not the base image.\")\n        layer_items = [d for d in data[1:] if \"url\" in d]\n        dropped = len(data) - 1 - len(layer_items)\n        if dropped > 0:\n            logging.warning(\n                \"ByteDance layer separation: %d of %d returned elements had no 'url' and were dropped.\",\n                dropped,\n                len(data) - 1,\n            )\n        if not layer_items:\n            raise RuntimeError(\"The model returned no layers. Try a different prompt or input image.\")\n        layer_items.sort(key=z_index_of)\n\n        base_image = (await download_url_to_image_tensor(str(base_item[\"url\"])))[..., :3].contiguous()\n        height, width = base_image.shape[1], base_image.shape[2]\n\n        specs = []\n        for item in layer_items:\n            flags = []\n            bbox = item.get(\"bounding_box\")\n            absolute = bbox.get(\"absolute\") if isinstance(bbox, dict) else None\n            if (\n                isinstance(absolute, (list, tuple))\n                and len(absolute) == 4\n                and all(isinstance(v, (int, float)) and not isinstance(v, bool) for v in absolute)\n            ):\n                left, top, right, bottom = (int(round(v)) for v in absolute)\n                rect_w, rect_h = right - left, bottom - top  # exclusive right/bottom\n                if rect_w > width or rect_h > height:","sourceCodeStart":1254,"sourceCodeEnd":1290,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_api_nodes/nodes_bytedance.py#L1254-L1290","documentation":"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.","triggerScenarios":"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.","commonSituations":"Using low-contrast or texture-only images; images where no distinct foreground objects exist; prompts that describe new content instead of guiding separation.","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."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"# pre-check the cheap local constraints before paying for a run\nassert get_number_of_images(image) == 1\nassert image.shape[2] >= 512 and image.shape[1] >= 512  # min dims\n# then choose an image with clearly separable objects; no code can guarantee layers","typeGuard":null,"tryCatchPattern":"try:\n    base, layers = await separate_layers(image)\nexcept RuntimeError as e:\n    if 'no layers' in str(e):\n        base, layers = await separate_layers(enhance_contrast(image))  # different input\n    else:\n        raise","preventionTips":["Use images with distinct foreground objects on a clean background.","Expect billing even when zero layers come back; validate inputs first."],"tags":["bytedance","seedream","layer-separation","empty-result","api-nodes"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}