Comfy-Org/ComfyUI · error · ValueError
LAYERS item type {item_type!r} is not supported yet
Error message
LAYERS item type {item_type!r} is not supported yet What it means
While iterating `doc['layers']`, each item's `type` field defaults to 'raster' when absent, and any other value raises immediately. The compositor currently only knows how to composite raster image layers, so text, shape, vector, or adjustment-layer entries are rejected rather than skipped, even if they would be invisible.
Source
Thrown at comfy_extras/nodes_compositor.py:39
from typing_extensions import override
MAX_LAYERS = 50
def document_items(doc) -> list[dict]:
if not isinstance(doc, dict):
return []
version = doc.get("version")
if version is not None and version != 1:
raise ValueError(f"LAYERS document version {version!r} is not supported")
items = []
for item in doc.get("layers") or []:
if not isinstance(item, dict):
continue
item_type = item.get("type", "raster")
if item_type != "raster":
raise ValueError(f"LAYERS item type {item_type!r} is not supported yet")
if not isinstance(item.get("image"), torch.Tensor):
continue
blend = item.get("blend_mode")
if blend is not None and blend not in _LAYER_MODES:
raise ValueError(f"LAYERS item blend_mode {blend!r} is not a known blend mode")
items.append(item)
return sorted(items, key=lambda item: _int(item.get("z_index"), 0))
def document_canvas(doc) -> tuple[int, int] | None:
if not isinstance(doc, dict):
return None
canvas = doc.get("canvas")
if not isinstance(canvas, (tuple, list)) or len(canvas) != 2:
return None
w, h = _int(canvas[0], 0), _int(canvas[1], 0)
return (w, h) if w > 0 and h > 0 else None
View on GitHub (pinned to 1c6d8d45b3)
Solutions
- Remove or filter out non-raster layer items before feeding the document to the node.
- Flatten text/shape layers to raster images in the source editor and re-export.
- Ensure each raster layer either omits `type` or sets it to "raster".
Example fix
// before
{"type": "text", "text": "hello", "image": null}
// after
{"type": "raster", "image": <flattened tensor>, "visible": false} Defensive patterns
Strategy: validation
Validate before calling
def only_raster(doc):
doc = dict(doc)
doc["layers"] = [
{**l, "type": "raster"}
for l in doc.get("layers") or []
if isinstance(l.get("image"), object) and l.get("type", "raster") == "raster"
]
return doc Type guard
def is_raster_layer(item) -> bool:
return not isinstance(item, dict) or item.get("type", "raster") == "raster" Try / catch
try:
items = document_items(doc)
except ValueError as e:
if "item type" in str(e):
doc = drop_non_raster(doc); items = document_items(doc)
else:
raise Prevention
- Flatten text/shape layers to raster images before export.
- Filter layers to type 'raster' (or absent) in your pipeline adapter.
- Keep the layer-type vocabulary in sync with _LAYER_MODES-era compositor support.
When it happens
Trigger: A LAYERS document containing any item with "type": "text", "shape", "vector", "group", "adjustment", etc. The check fires before the visibility flag is consulted, so even a hidden non-raster layer triggers it.
Common situations: Exporting a layered document from an editor that includes text or shape layers; frontends that plan richer layer kinds than the backend supports; version drift where new layer types were added to the schema.
Related errors
- LAYERS document version {version!r} is not supported
- LAYERS item blend_mode {blend!r} is not a known blend mode
- INVALID_TAG_FILTER
- Connect at least one keyframe image.
- Spreading {len(images)} images across the clip needs an expl
AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14).
Data as JSON: /api/errors/561242be631580d2.
Report an issue: GitHub.