{"record":{"id":"09f52ca5a269fe98","repo":"Comfy-Org/ComfyUI","slug":"failed-to-download-layer-i-1-of-len-specs","errorCode":null,"errorMessage":"Failed to download layer {i + 1} of {len(specs)} (name={item.get('name')!r}): {exc} The generation completed and was billed; the response with all layer URLs is in ComfyUI/temp/api_logs/.","messagePattern":"Failed to download layer (.+?) of (.+?) \\(name=(.+?)\\): (.+?) The generation completed and was billed; the response with all layer URLs is in ComfyUI/temp/api_logs/\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"comfy_api_nodes/nodes_bytedance.py","lineNumber":1322,"sourceCode":"        else:\n            canvas_w, canvas_h = width, height\n        base_mask = torch.zeros((1, height, width))\n        layers = torch.zeros((len(specs), canvas_h, canvas_w, 3))\n        # Create Layered Image / LoadImage mask convention: 1 = transparent\n        masks = torch.ones((len(specs), canvas_h, canvas_w))\n\n        semaphore = asyncio.Semaphore(4)\n\n        async def fetch_and_place(i: int, spec: dict) -> None:\n            item, flags = spec[\"item\"], spec[\"flags\"]\n            left, top, rect_w, rect_h = spec[\"left\"], spec[\"top\"], spec[\"rect_w\"], spec[\"rect_h\"]\n            async with semaphore:\n                try:\n                    rgba = (await download_url_to_image_tensor(str(item[\"url\"])))[0]\n                except ProcessingInterrupted:\n                    raise\n                except Exception as exc:\n                    raise RuntimeError(\n                        f\"Failed to download layer {i + 1} of {len(specs)} (name={item.get('name')!r}): {exc} \"\n                        \"The generation completed and was billed; the response with all layer URLs \"\n                        \"is in ComfyUI/temp/api_logs/.\"\n                    ) from exc\n            spec[\"native_size\"] = f\"{rgba.shape[1]}x{rgba.shape[0]}\"\n            if \"bbox_degenerate\" in flags:\n                return\n            if (rgba.shape[1], rgba.shape[0]) != (rect_w, rect_h):\n                # premultiply before resizing: interpolating straight alpha bleeds the undefined\n                # colors of transparent pixels into the anti-aliased edges\n                rgba = rgba.clone()\n                rgba[..., :3] *= rgba[..., 3:4]\n                rgba = (\n                    torch.nn.functional.interpolate(\n                        rgba.permute(2, 0, 1).unsqueeze(0),\n                        size=(rect_h, rect_w),\n                        mode=\"bilinear\",\n                        antialias=True,","sourceCodeStart":1304,"sourceCodeEnd":1340,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_api_nodes/nodes_bytedance.py#L1304-L1340","documentation":"Raised inside the layer separation node's concurrent download step (semaphore of 4) when download_url_to_image_tensor fails for one of the layer URLs. The message intentionally notes the generation already completed and was billed, and points to ComfyUI/temp/api_logs/ where the full response with all layer URLs is persisted so results are not lost.","triggerScenarios":"A transient network failure or expired/invalidated layer URL while fetching one of the RGBA layers after a successful generation; ProcessingInterrupted is re-raised untouched, this wrapper covers all other exceptions.","commonSituations":"Flaky connection or proxy timeout during parallel downloads; layer URLs expiring because the download phase started late; CDN hiccups.","solutions":["Recover manually: open the response JSON in ComfyUI/temp/api_logs/ and download the remaining layer URLs directly — you already paid for them.","Simply retry the node if re-billing is acceptable.","Stabilize the network (disable aggressive proxies/VPN) before rerunning expensive layer separations."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    result = await separate_layers(image)\nexcept RuntimeError as e:\n    if 'Failed to download layer' in str(e):\n        # generation succeeded and was billed: recover URLs from api_logs\n        layers = recover_layer_urls_from_api_logs(task_id)\n        result = rebuild_from_urls(layers)  # manual download, avoids re-billing\n    else:\n        raise","preventionTips":["After a billed run, always check ComfyUI/temp/api_logs/ before re-running.","Keep network stable during the download phase; the node downloads up to 4 layers in parallel."],"tags":["bytedance","seedream","layer-separation","network","download","api-nodes"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}