{"record":{"id":"1292ab5eb988a960","repo":"p-e-w/heretic","slug":"unknown-metadata-type-value-in-version-information","errorCode":null,"errorMessage":"unknown metadata.type value in version information: {metadata['type']}","messagePattern":"unknown metadata\\.type value in version information: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/heretic/reproduce.py","lineNumber":190,"sourceCode":"        return MismatchSeverity.LOW\n\n\ndef format_version_information(version_information: dict[str, Any]) -> str:\n    version = version_information[\"version\"]\n    metadata = version_information[\"metadata\"]\n\n    if \"type\" in metadata:\n        match metadata[\"type\"]:\n            case \"pypi\":\n                return version\n            case \"git\":\n                return f\"{version}-git+{metadata['url']}@{metadata['commit_hash']}\"\n            case \"local\":\n                # Append a random number to ensure that two local installations\n                # are always considered to be different versions.\n                return f\"{version}-local-{random.randint(2**16, 2**17)}\"\n            case _:\n                raise ValueError(\n                    f\"unknown metadata.type value in version information: {metadata['type']}\"\n                )\n    else:\n        return f\"{version}-unknown-{random.randint(2**16, 2**17)}\"\n\n\ndef check_environment(\n    settings: Settings,\n    reproduction_information: dict[str, Any],\n) -> bool | None:\n    mismatch_severity: MismatchSeverity | None = None\n\n    system_mismatches = []\n    package_mismatches = []\n\n    def verify(\n        mismatch_list: list[tuple[str, Any, Any, MismatchSeverity]],\n        name: str,","sourceCodeStart":172,"sourceCodeEnd":208,"githubUrl":"https://github.com/p-e-w/heretic/blob/bedb94ef117a271532ac2058447fbc165d5051bd/src/heretic/reproduce.py#L172-L208","documentation":"format_version_information builds a version string from install metadata and only knows metadata.type values like pip/git/local (plus an unknown fallback for missing metadata). If metadata['type'] carries an unrecognized value, the match statement's wildcard arm raises this ValueError. It signals version metadata produced by an unsupported install mechanism.","triggerScenarios":"Calling check_environment on an environment whose package version metadata contains a `type` value not handled by format_version_information's match cases.","commonSituations":"Exotic installs (conda, vendored builds) writing custom metadata.type values; a version of heretic-llm producing new metadata types the installed heretic doesn't understand.","solutions":["Upgrade heretic to a version that recognizes the new metadata.type.","Reinstall heretic-llm with a supported method (pip or git) so metadata.type is a known value.","Patch format_version_information to handle the new type or fall back to the unknown branch."],"exampleFix":"// before\ncase _: raise ValueError(f\"unknown metadata.type value in version information: {metadata['type']}\")\n// after\n# reinstall with a supported method so type is \"pip\"/\"git\"/\"local\"\npip install --force-reinstall heretic-llm","handlingStrategy":"try-catch","validationCode":"from importlib.metadata import distribution\nmeta = distribution(\"heretic-llm\").read_text(\"METADATA\")  # inspect install source before running reproduce checks","typeGuard":"def has_supported_version_type(metadata: dict) -> bool:\n    return metadata.get(\"type\") in {\"pip\", \"git\", \"local\"} or \"type\" not in metadata","tryCatchPattern":"try:\n    report = check_environment()\nexcept ValueError as e:\n    if str(e).startswith(\"unknown metadata.type value\"):\n        print(\"Reinstall heretic-llm via pip/git; metadata.type not supported\")\n    else:\n        raise","preventionTips":["Install heretic-llm via pip or git only.","Avoid packaging tools that write custom version metadata types.","Keep heretic upgraded to cover newer metadata formats."],"tags":["python","versioning","environment"],"backgroundTag":"unknown-metadata-value","analyzedSha":"bedb94ef117a271532ac2058447fbc165d5051bd","analyzedAt":"2026-08-29T08:38:06.692Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}