p-e-w/heretic · error · ValueError
unknown MismatchSeverity value: {self}
Error message
unknown MismatchSeverity value: {self} What it means
The __rich__ renderer for a MismatchSeverity value encountered an enum member it has no color mapping for. This indicates the MismatchSeverity enum was extended with a new value but the rich rendering match statement was not updated, or an out-of-range value was passed in.
Source
Thrown at src/heretic/reproduce.py:148
class MismatchSeverity(IntEnum):
LOW = 1
MEDIUM = 2
HIGH = 3
CRITICAL = 4
def __rich__(self) -> str:
match self:
case MismatchSeverity.LOW:
return "[green]low[/]"
case MismatchSeverity.MEDIUM:
return "[yellow]medium[/]"
case MismatchSeverity.HIGH:
return "[red]high[/]"
case MismatchSeverity.CRITICAL:
return "[bold red]critical[/]"
case _:
raise ValueError(f"unknown MismatchSeverity value: {self}")
def get_package_mismatch_severity(package_name: str) -> MismatchSeverity:
if package_name in [
"heretic-llm",
]:
return MismatchSeverity.CRITICAL
elif package_name in [
"torch",
"transformers",
]:
return MismatchSeverity.HIGH
elif package_name in [
"accelerate",
"bitsandbytes",
"kernels",
"optuna",
"peft",View on GitHub (pinned to bedb94ef11)
Solutions
- Upgrade heretic to a version whose __rich__ covers all MismatchSeverity members.
- Downgrade/align heretic-llm so the enum matches the known members.
- Report/patch the missing `case` arm for the new enum value.
Example fix
// before
match self:
case MismatchSeverity.CRITICAL: return "[bold red]critical[/]"
// after
match self:
case MismatchSeverity.CRITICAL: return "[bold red]critical[/]"
case _: raise ValueError(f"unknown MismatchSeverity value: {self}") # add new case before wildcard Defensive patterns
Strategy: try-catch
Validate before calling
try:
MismatchSeverity(getattr(sev, "value", sev))
assert sev in {MismatchSeverity.LOW, MismatchSeverity.MEDIUM, MismatchSeverity.HIGH, MismatchSeverity.CRITICAL}
except (ValueError, AssertionError):
pass # treat as unknown mismatch before rendering Type guard
def is_known_severity(s) -> bool:
return s in {MismatchSeverity.LOW, MismatchSeverity.MEDIUM, MismatchSeverity.HIGH, MismatchSeverity.CRITICAL} Try / catch
try:
report.rich_output()
except ValueError as e:
if str(e).startswith("unknown MismatchSeverity value"):
print("heretic version out of sync with severity enum; upgrade heretic")
else:
raise Prevention
- Keep heretic and heretic-llm versions in sync.
- Pin dependency versions in your environment.
- When extending the enum, update __rich__ in the same change.
When it happens
Trigger: Calling check_environment (which calls __rich__ on each MismatchSeverity) with a MismatchSeverity value outside the LOW/MEDIUM/HIGH/CRITICAL set handled by the match statement.
Common situations: Upgrading heretic or heretic-llm so the enum gains a new severity that the installed reproduce module's formatter doesn't know; custom code constructing MismatchSeverity directly.
Related errors
- cannot be empty or whitespace
- Plugin '{name}' does not export a class named '{class_name}'
- You must append the plugin class name to the filepath like t
- File-based plugin must use the form 'path/to/plugin.py:Class
- Could not load plugin '{name}' (invalid module spec)
AI-assisted analysis of p-e-w/heretic@bedb94ef11 (2026-08-29).
Data as JSON: /api/errors/ef5b5d315ec1335e.
Report an issue: GitHub.