Comfy-Org/ComfyUI · error · ValueError
Invalid {cls.__name__} string: '{value}'. Valid values are:
Error message
Invalid {cls.__name__} string: '{value}'. Valid values are: {valid_values} What it means
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.
Source
Thrown at comfy/ldm/lightricks/vae/causal_audio_autoencoder.py:67
# 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:
if member.value is None:
valid_values.append("none")
elif isinstance(member.value, str):
valid_values.append(member.value)
raise ValueError(f"Invalid {cls.__name__} string: '{value}'. " f"Valid values are: {valid_values}")
raise ValueError(
f"Cannot convert type {type(value).__name__} to {cls.__name__} enum. "
f"Expected string, None, or {cls.__name__} instance."
)
class AttentionType(StringConvertibleEnum):
"""Enum for specifying the attention mechanism type."""
VANILLA = "vanilla"
LINEAR = "linear"
NONE = "none"
class CausalityAxis(StringConvertibleEnum):
"""Enum for specifying the causality axis in causal convolutions."""
View on GitHub (pinned to 1c6d8d45b3)
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
Example fix
# before block = make_attention(in_channels, attn_type="vanila") # after block = make_attention(in_channels, attn_type="vanilla")
Defensive patterns
Strategy: validation
Validate before calling
VALID_ATTN = {m.value for m in AttentionType}
if isinstance(attn_type, str) and attn_type.lower() not in VALID_ATTN:
raise ValueError(f"bad attention type {attn_type!r}; valid: {sorted(VALID_ATTN)}")
attn_type = AttentionType(attn_type) Type guard
def is_valid_enum_string(cls, s: str) -> bool:
return any(isinstance(m.value, str) and m.value.lower() == s.lower() for m in cls) or (s.lower() == "none" and hasattr(cls, "NONE")) Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- {cls.__name__} does not have a NONE member to map None to
- Cannot convert type {type(value).__name__} to {cls.__name__}
- Invalid normalization type: {normtype}
- Invalid causality_axis: {causality_axis}
- Unknown context_schedule '{context_schedule}'.
AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14).
Data as JSON: /api/errors/e7ea6c0333dc8043.
Report an issue: GitHub.