{"record":{"id":"c89a878f65269f81","repo":"Comfy-Org/ComfyUI","slug":"unexpected-response-no-base-image-returned","errorCode":null,"errorMessage":"Unexpected response: no base image returned.","messagePattern":"Unexpected response: no base image returned\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"comfy_api_nodes/nodes_bytedance.py","lineNumber":1255,"sourceCode":"                f\"ByteDance request failed. Code: {response.error['code']}, message: {response.error['message']}\"\n            )\n\n        def z_index_of(d: dict) -> int:\n            v = d.get(\"z_index\")\n            if isinstance(v, bool):\n                return 1_000_000\n            if isinstance(v, (int, float)):\n                return int(v)\n            if isinstance(v, str):\n                try:\n                    return int(v.strip())\n                except ValueError:\n                    return 1_000_000\n            return 1_000_000\n\n        data = [d for d in (response.data or []) if isinstance(d, dict)]\n        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)","sourceCodeStart":1237,"sourceCodeEnd":1273,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_api_nodes/nodes_bytedance.py#L1237-L1273","documentation":"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.","triggerScenarios":"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).","commonSituations":"Upstream API contract change or A/B behavior on BytePlus side; the model returning only layer items without the base image; transient malformed payload.","solutions":["Retry the request — malformed payloads are often transient.","Update ComfyUI/comfy_api_nodes to the latest version in case the response parser was adapted to a new payload shape.","Report the issue with ComfyUI/temp/api_logs/ content if it reproduces consistently."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"for attempt in range(3):\n    try:\n        return await separate_layers(image)\n    except RuntimeError as e:\n        if 'no base image returned' in str(e) and attempt < 2:\n            await asyncio.sleep(2 ** attempt)\n            continue\n        raise","preventionTips":["Treat malformed-payload errors as transient first; persist api_logs for diagnosis.","Keep comfy_api_nodes updated so parser matches the live contract."],"tags":["bytedance","seedream","layer-separation","unexpected-response","api-nodes"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}