p-e-w/heretic · error · ValueError
unknown metadata.type value in version information: {metadat
Error message
unknown metadata.type value in version information: {metadata['type']} What it means
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.
Source
Thrown at src/heretic/reproduce.py:190
return MismatchSeverity.LOW
def format_version_information(version_information: dict[str, Any]) -> str:
version = version_information["version"]
metadata = version_information["metadata"]
if "type" in metadata:
match metadata["type"]:
case "pypi":
return version
case "git":
return f"{version}-git+{metadata['url']}@{metadata['commit_hash']}"
case "local":
# Append a random number to ensure that two local installations
# are always considered to be different versions.
return f"{version}-local-{random.randint(2**16, 2**17)}"
case _:
raise ValueError(
f"unknown metadata.type value in version information: {metadata['type']}"
)
else:
return f"{version}-unknown-{random.randint(2**16, 2**17)}"
def check_environment(
settings: Settings,
reproduction_information: dict[str, Any],
) -> bool | None:
mismatch_severity: MismatchSeverity | None = None
system_mismatches = []
package_mismatches = []
def verify(
mismatch_list: list[tuple[str, Any, Any, MismatchSeverity]],
name: str,View on GitHub (pinned to bedb94ef11)
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.
Example fix
// before
case _: raise ValueError(f"unknown metadata.type value in version information: {metadata['type']}")
// after
# reinstall with a supported method so type is "pip"/"git"/"local"
pip install --force-reinstall heretic-llm Defensive patterns
Strategy: try-catch
Validate before calling
from importlib.metadata import distribution
meta = distribution("heretic-llm").read_text("METADATA") # inspect install source before running reproduce checks Type guard
def has_supported_version_type(metadata: dict) -> bool:
return metadata.get("type") in {"pip", "git", "local"} or "type" not in metadata Try / catch
try:
report = check_environment()
except ValueError as e:
if str(e).startswith("unknown metadata.type value"):
print("Reinstall heretic-llm via pip/git; metadata.type not supported")
else:
raise Prevention
- 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.
When it happens
Trigger: Calling check_environment on an environment whose package version metadata contains a `type` value not handled by format_version_information's match cases.
Common situations: 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.
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/1292ab5eb988a960.
Report an issue: GitHub.