Comfy-Org/ComfyUI · error · TypeError

Unsupported input type: {type(value).__name__}

Error message

Unsupported input type: {type(value).__name__}

What it means

Raised as TypeError when the value passed to the number-conversion node is not bool, int, float, or str (e.g. a list, dict, tensor, or None). The node deliberately enumerates supported types instead of duck-typing, so any other type fails fast with the actual type name.

Source

Thrown at comfy_extras/nodes_number_convert.py:72

            text = value.strip()
            if not text:
                raise ValueError("Cannot convert empty string to number.")
            try:
                float_val = float(text)
            except ValueError:
                raise ValueError(
                    f"Cannot convert string to number: {value!r}"
                ) from None
            if not math.isfinite(float_val):
                raise ValueError(
                    f"Cannot convert non-finite value to number: {float_val}"
                )
            try:
                int_val = int(text)
            except ValueError:
                int_val = int(float_val)
        else:
            raise TypeError(
                f"Unsupported input type: {type(value).__name__}"
            )

        if not math.isfinite(float_val):
            raise ValueError(
                f"Cannot convert non-finite value to number: {float_val}"
            )

        return io.NodeOutput(float_val, int_val)


class NumberConvertExtension(ComfyExtension):
    @override
    async def get_node_list(self) -> list[type[io.ComfyNode]]:
        return [NumberConvertNode]


async def comfy_entrypoint() -> NumberConvertExtension:

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Connect a scalar source: a number primitive, boolean, or a string containing a number.
  2. For tensors, first extract a scalar with an appropriate node (e.g. indexing/reduction) before conversion.
  3. For lists, pick a single element upstream instead of passing the whole list.

Example fix

// before
NumberConvert(value=[1, 2, 3])
// after
NumberConvert(value=1)
Defensive patterns

Strategy: type-guard

Validate before calling

if not isinstance(value, (bool, int, float, str)):
    raise TypeError(f"NumberConvert expects bool/int/float/str, got {type(value).__name__}")

Type guard

def is_convertible_number_input(v) -> bool:
    return isinstance(v, (bool, int, float, str))

Prevention

When it happens

Trigger: Connecting a LIST, DICT, IMAGE tensor, or None output to the converter's value input, or sending such a JSON value via the API prompt.

Common situations: Workflow wiring mistakes where a container/tensor output is connected to a number slot; API payloads passing null or nested objects for what should be a scalar.

Related errors


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