Comfy-Org/ComfyUI · error · ValueError

{cls.__name__} does not have a NONE member to map None to

Error message

{cls.__name__} does not have a NONE member to map None to

What it means

Raised by StringConvertibleEnum._missing_ (used via coerce-style conversion) in the Lightricks causal audio autoencoder when None is passed for an enum field whose class has no NONE member. The enum tries to map None to a NONE member and fails. Only enums like CausalityAxis that explicitly define NONE = None can accept None.

Source

Thrown at comfy/ldm/lightricks/vae/causal_audio_autoencoder.py:43

        Args:
            value: Can be an enum instance of this class, a string, or None

        Returns:
            Enum member of this class

        Raises:
            ValueError: If the value cannot be converted to a valid enum member
        """
        # Already an enum instance of this class
        if isinstance(value, cls):
            return value

        # None maps to NONE member if it exists
        if value is None:
            if hasattr(cls, "NONE"):
                return cls.NONE
            raise ValueError(f"{cls.__name__} does not have a NONE member to map None to")

        # String conversion (case-insensitive)
        if isinstance(value, str):
            value_lower = value.lower()

            # Try to match against enum values
            for member in cls:
                # Handle members with None values
                if member.value is None:
                    if value_lower == "none":
                        return member
                # Handle members with string values
                elif isinstance(member.value, str) and member.value.lower() == value_lower:
                    return member

            # Build helpful error message with valid values
            valid_values = []
            for member in cls:

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Pass the string 'none' or the enum member (e.g. AttentionType.NONE) instead of None
  2. If you own the enum subclass, add a NONE = None member so None maps to it
  3. Pass an existing enum instance of the same class, which is returned as-is

Example fix

# before
attn = make_attention(in_channels, attn_type=None)

# after
attn = make_attention(in_channels, attn_type=AttentionType.NONE)
Defensive patterns

Strategy: validation

Validate before calling

def coerce_enum(cls, value):
    if value is None and not hasattr(cls, "NONE"):
        raise ValueError(f"{cls.__name__} has no NONE member; pass 'none' or a member")
    return cls(value)

axis = coerce_enum(CausalityAxis, maybe_none_value)

Type guard

def is_convertible_enum_value(cls, v) -> bool:
    return isinstance(v, cls) or v is None and hasattr(cls, "NONE") or isinstance(v, str)

Prevention

When it happens

Trigger: Passing None as a CausalityAxis/AttentionType argument (e.g. make_conv2d(..., causality_axis=None) or AttentionType(None)) where the enum class lacks a NONE member. AttentionType.NONE exists as "none" so None-coercion works there, but other StringConvertibleEnum subclasses without NONE raise this at construction time.

Common situations: Porting config code from the original lightricks repo that used None as a sentinel; YAML/JSON configs with null values fed into enum-typed fields; building an Encoder with attention_type=None.

Related errors


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