AlexsJones/llmfit · error · ValueError

Unknown LLMFIT_PYTHON_PLATFORM_TAG=

Error message

Unknown LLMFIT_PYTHON_PLATFORM_TAG={py_target!r}. Must be one of: {sorted(TARGET_CONFIGS)}

What it means

Raised in initialize() when LLMFIT_PYTHON_PLATFORM_TAG is set to a value that is not a key of TARGET_CONFIGS. The message helpfully lists the exact sorted set of supported tags (manylinux_2_17_x86_64, manylinux_2_17_aarch64, manylinux_2_39_riscv64, musllinux_1_2_x86_64, musllinux_1_2_aarch64, macosx_10_12_x86_64, macosx_11_0_arm64, win_amd64, win_arm64). Typos, CPython-specific variants, or tags belonging to another packaging scheme are rejected before any binary lookup.

Solutions

  1. Copy a tag verbatim from the error message's sorted(TARGET_CONFIGS) list — e.g. manylinux_2_17_x86_64, macosx_11_0_arm64, win_amd64
  2. Unset the variable to let the hook autodetect the running platform: `unset LLMFIT_PYTHON_PLATFORM_TAG && uv build`
  3. If you truly need a new tag (e.g. a newer macOS or manylinux micro version), add it to TARGET_CONFIGS in hatch_build.py first

Example fix

# before
export LLMFIT_PYTHON_PLATFORM_TAG=linux_x86_64
uv build  # ValueError: Unknown LLMFIT_PYTHON_PLATFORM_TAG

# after
export LLMFIT_PYTHON_PLATFORM_TAG=manylinux_2_17_x86_64
uv build
Defensive patterns

Strategy: validation

Validate before calling

import os
from hatch_build import TARGET_CONFIGS
tag = os.environ.get("LLMFIT_PYTHON_PLATFORM_TAG")
if tag and tag not in TARGET_CONFIGS:
    raise SystemExit(f"bad LLMFIT_PYTHON_PLATFORM_TAG={tag!r}; valid: {sorted(TARGET_CONFIGS)}")

Type guard

def is_valid_platform_tag(tag: str) -> bool:
    """True when tag is a supported wheel platform in TARGET_CONFIGS."""
    from hatch_build import TARGET_CONFIGS
    return tag in TARGET_CONFIGS

Try / catch

try:
    hook.initialize("standard", build_data)
except ValueError as e:
    raise SystemExit(f"platform tag rejected: {e}")

Prevention

When it happens

Trigger: Setting LLMFIT_PYTHON_PLATFORM_TAG=linux_x86_64 (the naive form instead of manylinux_2_17_x86_64), =manylinux_2_28_aarch64 (unsupported micro version), =macosx_14_0_arm64 (version above the registered 11_0 key), or any misspelling, then running a standard build.

Common situations: Guessing the tag from `pip debug --verbose` output (which lists many candidates, only some of which are configured here); copying a tag from another project's CI; CI matrix drift after TARGET_CONFIGS gains/loses entries.

Understand the failure class

Background: "is not a valid" / "Invalid ... value" environment variable errors: how libraries validate env vars and what to do when they reject yours — this error's family across 48 libraries.

Related errors


AI-assisted analysis of AlexsJones/llmfit@acc7e40c3a (2026-08-17). Data as JSON: /api/errors/c9afd108558c2372. Report an issue: GitHub.

Appendix: source

Thrown at llmfit-python/hatch_build.py:176

            raise RuntimeError(
                f"Binary version mismatch: binary at {bin_path} reports {binary_version!r} "
                f"but Cargo.toml (or LLMFIT_VERSION) says {expected_version!r}. "
                "Run 'make build' to recompile.",
            )
        print(f"  Binary version OK ({binary_version})")

    def initialize(self, version: str, build_data: dict) -> None:
        """Locate the platform binary and configure the wheel before it is built."""
        py_target_from_env = os.environ.get("LLMFIT_PYTHON_PLATFORM_TAG")
        if version == "editable" and py_target_from_env:
            raise ValueError(
                "LLMFIT_PYTHON_PLATFORM_TAG is not supported for editable installs. "
                "Let the build system detect the host platform instead.",
            )
        running_platform = self._detect_platform()
        py_target = py_target_from_env or running_platform
        if py_target not in TARGET_CONFIGS:
            raise ValueError(
                f"Unknown LLMFIT_PYTHON_PLATFORM_TAG={py_target!r}. Must be one of: {sorted(TARGET_CONFIGS)}",
            )

        upstream_target, binary_name = TARGET_CONFIGS[py_target]
        pypi_version: str = self.metadata.version

        print(f"  target={upstream_target}  version={pypi_version}  wheel tag=py3-none-{py_target}")

        llmfit_root = Path(self.root).parent
        if version == "editable":
            # For editable installs, look for target/debug/llmfit or target/release/llmfit (or llmfit.exe on Windows).
            bin_path = self._find_local_binary(llmfit_root)
        elif version == "standard":
            # For release installs, look for e.g. target/x86_64-unknown-linux-gnu/release/llmfit on Linux.
            bin_path = self._find_binary_for_target(llmfit_root, py_target)
        else:
            raise ValueError(f"Unknown version: {version!r}")

View on GitHub (pinned to acc7e40c3a)