{"record":{"id":"561242be631580d2","repo":"Comfy-Org/ComfyUI","slug":"layers-item-type-item-type-r-is-not-supported-ye","errorCode":null,"errorMessage":"LAYERS item type {item_type!r} is not supported yet","messagePattern":"LAYERS item type (.+?) is not supported yet","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_extras/nodes_compositor.py","lineNumber":39,"sourceCode":"from typing_extensions import override\n\n\nMAX_LAYERS = 50\n\n\ndef document_items(doc) -> list[dict]:\n    if not isinstance(doc, dict):\n        return []\n    version = doc.get(\"version\")\n    if version is not None and version != 1:\n        raise ValueError(f\"LAYERS document version {version!r} is not supported\")\n    items = []\n    for item in doc.get(\"layers\") or []:\n        if not isinstance(item, dict):\n            continue\n        item_type = item.get(\"type\", \"raster\")\n        if item_type != \"raster\":\n            raise ValueError(f\"LAYERS item type {item_type!r} is not supported yet\")\n        if not isinstance(item.get(\"image\"), torch.Tensor):\n            continue\n        blend = item.get(\"blend_mode\")\n        if blend is not None and blend not in _LAYER_MODES:\n            raise ValueError(f\"LAYERS item blend_mode {blend!r} is not a known blend mode\")\n        items.append(item)\n    return sorted(items, key=lambda item: _int(item.get(\"z_index\"), 0))\n\n\ndef document_canvas(doc) -> tuple[int, int] | None:\n    if not isinstance(doc, dict):\n        return None\n    canvas = doc.get(\"canvas\")\n    if not isinstance(canvas, (tuple, list)) or len(canvas) != 2:\n        return None\n    w, h = _int(canvas[0], 0), _int(canvas[1], 0)\n    return (w, h) if w > 0 and h > 0 else None\n","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_extras/nodes_compositor.py#L21-L57","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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\"."],"exampleFix":"// before\n{\"type\": \"text\", \"text\": \"hello\", \"image\": null}\n// after\n{\"type\": \"raster\", \"image\": <flattened tensor>, \"visible\": false}","handlingStrategy":"validation","validationCode":"def only_raster(doc):\n    doc = dict(doc)\n    doc[\"layers\"] = [\n        {**l, \"type\": \"raster\"}\n        for l in doc.get(\"layers\") or []\n        if isinstance(l.get(\"image\"), object) and l.get(\"type\", \"raster\") == \"raster\"\n    ]\n    return doc","typeGuard":"def is_raster_layer(item) -> bool:\n    return not isinstance(item, dict) or item.get(\"type\", \"raster\") == \"raster\"","tryCatchPattern":"try:\n    items = document_items(doc)\nexcept ValueError as e:\n    if \"item type\" in str(e):\n        doc = drop_non_raster(doc); items = document_items(doc)\n    else:\n        raise","preventionTips":["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."],"tags":["validation","layers-document","layer-type","comfyui"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}