{"record":{"id":"57ba0858027793bd","repo":"Comfy-Org/ComfyUI","slug":"cls-name-does-not-have-a-none-member-to-map","errorCode":null,"errorMessage":"{cls.__name__} does not have a NONE member to map None to","messagePattern":"(.+?) does not have a NONE member to map None to","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy/ldm/lightricks/vae/causal_audio_autoencoder.py","lineNumber":43,"sourceCode":"\n        Args:\n            value: Can be an enum instance of this class, a string, or None\n\n        Returns:\n            Enum member of this class\n\n        Raises:\n            ValueError: If the value cannot be converted to a valid enum member\n        \"\"\"\n        # Already an enum instance of this class\n        if isinstance(value, cls):\n            return value\n\n        # None maps to NONE member if it exists\n        if value is None:\n            if hasattr(cls, \"NONE\"):\n                return cls.NONE\n            raise ValueError(f\"{cls.__name__} does not have a NONE member to map None to\")\n\n        # String conversion (case-insensitive)\n        if isinstance(value, str):\n            value_lower = value.lower()\n\n            # Try to match against enum values\n            for member in cls:\n                # Handle members with None values\n                if member.value is None:\n                    if value_lower == \"none\":\n                        return member\n                # Handle members with string values\n                elif isinstance(member.value, str) and member.value.lower() == value_lower:\n                    return member\n\n            # Build helpful error message with valid values\n            valid_values = []\n            for member in cls:","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy/ldm/lightricks/vae/causal_audio_autoencoder.py#L25-L61","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Pass the string 'none' or the enum member (e.g. AttentionType.NONE) instead of None","If you own the enum subclass, add a NONE = None member so None maps to it","Pass an existing enum instance of the same class, which is returned as-is"],"exampleFix":"# before\nattn = make_attention(in_channels, attn_type=None)\n\n# after\nattn = make_attention(in_channels, attn_type=AttentionType.NONE)","handlingStrategy":"validation","validationCode":"def coerce_enum(cls, value):\n    if value is None and not hasattr(cls, \"NONE\"):\n        raise ValueError(f\"{cls.__name__} has no NONE member; pass 'none' or a member\")\n    return cls(value)\n\naxis = coerce_enum(CausalityAxis, maybe_none_value)","typeGuard":"def is_convertible_enum_value(cls, v) -> bool:\n    return isinstance(v, cls) or v is None and hasattr(cls, \"NONE\") or isinstance(v, str)","tryCatchPattern":null,"preventionTips":["Never pass None to enum-typed fields unless you verified the class defines NONE","Centralize enum conversion in one helper so invalid inputs fail at the boundary with a clear message","Prefer passing enum members over strings or None in application code"],"tags":["enum","validation","audio-vae","constructor"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}