{"record":{"id":"ef5b5d315ec1335e","repo":"p-e-w/heretic","slug":"unknown-mismatchseverity-value-self","errorCode":null,"errorMessage":"unknown MismatchSeverity value: {self}","messagePattern":"unknown MismatchSeverity value: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/heretic/reproduce.py","lineNumber":148,"sourceCode":"\nclass MismatchSeverity(IntEnum):\n    LOW = 1\n    MEDIUM = 2\n    HIGH = 3\n    CRITICAL = 4\n\n    def __rich__(self) -> str:\n        match self:\n            case MismatchSeverity.LOW:\n                return \"[green]low[/]\"\n            case MismatchSeverity.MEDIUM:\n                return \"[yellow]medium[/]\"\n            case MismatchSeverity.HIGH:\n                return \"[red]high[/]\"\n            case MismatchSeverity.CRITICAL:\n                return \"[bold red]critical[/]\"\n            case _:\n                raise ValueError(f\"unknown MismatchSeverity value: {self}\")\n\n\ndef get_package_mismatch_severity(package_name: str) -> MismatchSeverity:\n    if package_name in [\n        \"heretic-llm\",\n    ]:\n        return MismatchSeverity.CRITICAL\n    elif package_name in [\n        \"torch\",\n        \"transformers\",\n    ]:\n        return MismatchSeverity.HIGH\n    elif package_name in [\n        \"accelerate\",\n        \"bitsandbytes\",\n        \"kernels\",\n        \"optuna\",\n        \"peft\",","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/p-e-w/heretic/blob/bedb94ef117a271532ac2058447fbc165d5051bd/src/heretic/reproduce.py#L130-L166","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nmatch self:\n    case MismatchSeverity.CRITICAL: return \"[bold red]critical[/]\"\n// after\nmatch self:\n    case MismatchSeverity.CRITICAL: return \"[bold red]critical[/]\"\n    case _: raise ValueError(f\"unknown MismatchSeverity value: {self}\")  # add new case before wildcard","handlingStrategy":"try-catch","validationCode":"try:\n    MismatchSeverity(getattr(sev, \"value\", sev))\n    assert sev in {MismatchSeverity.LOW, MismatchSeverity.MEDIUM, MismatchSeverity.HIGH, MismatchSeverity.CRITICAL}\nexcept (ValueError, AssertionError):\n    pass  # treat as unknown mismatch before rendering","typeGuard":"def is_known_severity(s) -> bool:\n    return s in {MismatchSeverity.LOW, MismatchSeverity.MEDIUM, MismatchSeverity.HIGH, MismatchSeverity.CRITICAL}","tryCatchPattern":"try:\n    report.rich_output()\nexcept ValueError as e:\n    if str(e).startswith(\"unknown MismatchSeverity value\"):\n        print(\"heretic version out of sync with severity enum; upgrade heretic\")\n    else:\n        raise","preventionTips":["Keep heretic and heretic-llm versions in sync.","Pin dependency versions in your environment.","When extending the enum, update __rich__ in the same change."],"tags":["python","enum","internal-inconsistency"],"backgroundTag":"unhandled-enum-value","analyzedSha":"bedb94ef117a271532ac2058447fbc165d5051bd","analyzedAt":"2026-08-29T08:38:06.692Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}