{"record":{"id":"e7ea6c0333dc8043","repo":"Comfy-Org/ComfyUI","slug":"invalid-cls-name-string-value-valid-va","errorCode":null,"errorMessage":"Invalid {cls.__name__} string: '{value}'. Valid values are: {valid_values}","messagePattern":"Invalid (.+?) string: '(.+?)'\\. Valid values are: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy/ldm/lightricks/vae/causal_audio_autoencoder.py","lineNumber":67,"sourceCode":"            # 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:\n                if member.value is None:\n                    valid_values.append(\"none\")\n                elif isinstance(member.value, str):\n                    valid_values.append(member.value)\n\n            raise ValueError(f\"Invalid {cls.__name__} string: '{value}'. \" f\"Valid values are: {valid_values}\")\n\n        raise ValueError(\n            f\"Cannot convert type {type(value).__name__} to {cls.__name__} enum. \"\n            f\"Expected string, None, or {cls.__name__} instance.\"\n        )\n\n\nclass AttentionType(StringConvertibleEnum):\n    \"\"\"Enum for specifying the attention mechanism type.\"\"\"\n\n    VANILLA = \"vanilla\"\n    LINEAR = \"linear\"\n    NONE = \"none\"\n\n\nclass CausalityAxis(StringConvertibleEnum):\n    \"\"\"Enum for specifying the causality axis in causal convolutions.\"\"\"\n","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy/ldm/lightricks/vae/causal_audio_autoencoder.py#L49-L85","documentation":"Raised by StringConvertibleEnum when a string value cannot be matched (case-insensitively) to any member value of the enum. The message lists all valid string values, including 'none' for members whose value is None. This is the enum's input-validation error for bad string config values.","triggerScenarios":"Calling a constructor that converts a string to AttentionType/CausalityAxis with a misspelled or unsupported value, e.g. CausalityAxis('widht'), AttentionType('linear-attention'), or AttentionType('off') instead of AttentionType.NONE.","commonSituations":"Typos in checkpoint-derived or user-supplied config dicts; renaming mismatches when porting configs from the upstream lightricks repository (e.g. 'vanilla' vs 'standard'); case variants like 'Vanilla' work but 'n/a' do not.","solutions":["Use one of the valid values printed in the error message (e.g. 'vanilla', 'linear', 'none' for AttentionType)","Check spelling and hyphenation against the enum definition in causal_audio_autoencoder.py","Pass the enum member itself (AttentionType.VANILLA) instead of a string to avoid conversion entirely"],"exampleFix":"# before\nblock = make_attention(in_channels, attn_type=\"vanila\")\n\n# after\nblock = make_attention(in_channels, attn_type=\"vanilla\")","handlingStrategy":"validation","validationCode":"VALID_ATTN = {m.value for m in AttentionType}\nif isinstance(attn_type, str) and attn_type.lower() not in VALID_ATTN:\n    raise ValueError(f\"bad attention type {attn_type!r}; valid: {sorted(VALID_ATTN)}\")\nattn_type = AttentionType(attn_type)","typeGuard":"def is_valid_enum_string(cls, s: str) -> bool:\n    return any(isinstance(m.value, str) and m.value.lower() == s.lower() for m in cls) or (s.lower() == \"none\" and hasattr(cls, \"NONE\"))","tryCatchPattern":null,"preventionTips":["Validate config strings against the enum before constructing modules","Log the valid-values list (it is in the error message) when surfacing config errors to users","Generate config UIs from the enum members instead of free-text fields"],"tags":["enum","validation","audio-vae","config"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}