Comfy-Org/ComfyUI · error · Exception

Node {cls.__name__} is not expandable, but expand included i

Error message

Node {cls.__name__} is not expandable, but expand included in NodeOutput; developer should set enable_expand=True on node's Schema to allow this.

What it means

A node's execute() returned a NodeOutput carrying an `expand` payload, but the node's SCHEMA does not set enable_expand=True. Expansion is an opt-in capability; the executor refuses to silently drop the expand data or run it for a node that never declared support.

Source

Thrown at comfy_api/latest/_io.py:2004

    @final
    @classmethod
    def EXECUTE_NORMALIZED(cls, *args, **kwargs) -> NodeOutput:
        to_return = cls.execute(*args, **kwargs)
        if to_return is None:
            to_return = NodeOutput()
        elif isinstance(to_return, NodeOutput):
            pass
        elif isinstance(to_return, tuple):
            to_return = NodeOutput(*to_return)
        elif isinstance(to_return, dict):
            to_return = NodeOutput.from_dict(to_return)
        elif isinstance(to_return, ExecutionBlocker):
            to_return = NodeOutput(block_execution=to_return.message)
        else:
            raise Exception(f"Invalid return type from node: {type(to_return)}")
        if to_return.expand is not None and not cls.SCHEMA.enable_expand:
            raise Exception(f"Node {cls.__name__} is not expandable, but expand included in NodeOutput; developer should set enable_expand=True on node's Schema to allow this.")
        return to_return

    @final
    @classmethod
    async def EXECUTE_NORMALIZED_ASYNC(cls, *args, **kwargs) -> NodeOutput:
        to_return = await cls.execute(*args, **kwargs)
        if to_return is None:
            to_return = NodeOutput()
        elif isinstance(to_return, NodeOutput):
            pass
        elif isinstance(to_return, tuple):
            to_return = NodeOutput(*to_return)
        elif isinstance(to_return, dict):
            to_return = NodeOutput.from_dict(to_return)
        elif isinstance(to_return, ExecutionBlocker):
            to_return = NodeOutput(block_execution=to_return.message)
        else:
            raise Exception(f"Invalid return type from node: {type(to_return)}")

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Set enable_expand=True on the node's Schema if expansion is intended.
  2. Otherwise remove the expand argument from the returned NodeOutput.

Example fix

# before
class Schema(IO.Schema):
    enable_expand = False
# execute returns NodeOutput(expand=...) -> Exception

# after
class Schema(IO.Schema):
    enable_expand = True
Defensive patterns

Strategy: validation

Validate before calling

assert cls.SCHEMA.enable_expand or output.expand is None, "set enable_expand=True to return expand"

Type guard

def expand_allowed(cls) -> bool:
    return bool(getattr(cls.SCHEMA, "enable_expand", False))

Prevention

When it happens

Trigger: Node code builds NodeOutput(expand=...) while the node's Schema lacks enable_expand=True — typically after adding expand logic without updating the schema, or copying expand-producing code into another node.

Common situations: Copying an expandable node's execute body into a non-expandable node; schema refactors dropping the flag; enable_expand set on the wrong class in an inheritance chain.

Related errors


AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14). Data as JSON: /api/errors/6afa110a7b45c192. Report an issue: GitHub.