{"record":{"id":"ec0fa61cb3543062","repo":"AlexsJones/llmfit","slug":"unknown-version-version-r","errorCode":null,"errorMessage":"Unknown version: {version!r}","messagePattern":"Unknown version: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"warning","filePath":"llmfit-python/hatch_build.py","lineNumber":193,"sourceCode":"        if py_target not in TARGET_CONFIGS:\n            raise ValueError(\n                f\"Unknown LLMFIT_PYTHON_PLATFORM_TAG={py_target!r}. Must be one of: {sorted(TARGET_CONFIGS)}\",\n            )\n\n        upstream_target, binary_name = TARGET_CONFIGS[py_target]\n        pypi_version: str = self.metadata.version\n\n        print(f\"  target={upstream_target}  version={pypi_version}  wheel tag=py3-none-{py_target}\")\n\n        llmfit_root = Path(self.root).parent\n        if version == \"editable\":\n            # For editable installs, look for target/debug/llmfit or target/release/llmfit (or llmfit.exe on Windows).\n            bin_path = self._find_local_binary(llmfit_root)\n        elif version == \"standard\":\n            # For release installs, look for e.g. target/x86_64-unknown-linux-gnu/release/llmfit on Linux.\n            bin_path = self._find_binary_for_target(llmfit_root, py_target)\n        else:\n            raise ValueError(f\"Unknown version: {version!r}\")\n\n        # Always check that the binary exists.\n        if not bin_path.is_file():\n            raise FileNotFoundError(\n                f\"Binary not found at {bin_path}. The binary selection logic selected a file that does not exist.\",\n            )\n\n        # If possible, check the self-reported version of the binary.\n        # If the binary was built for a different platform then it's not possible.\n        if py_target == running_platform:\n            self._check_binary_version(bin_path, pypi_version)\n\n        # Place the binary in the wheel's scripts directory so that the\n        # installer puts it in .venv/bin/ (or Scripts/ on Windows).\n        build_data[\"shared_scripts\"][str(bin_path.absolute())] = binary_name\n\n        # Override the platform tag so the wheel gets the correct platform-specific name.\n        build_data[\"tag\"] = f\"py3-none-{py_target}\"","sourceCodeStart":175,"sourceCodeEnd":211,"githubUrl":"https://github.com/AlexsJones/llmfit/blob/a9ac7ed91c1729cd93944bc1338e8313daaba8fa/llmfit-python/hatch_build.py#L175-L211","documentation":"Hatchling invokes the build hook with version='standard' for wheel builds and version='editable' for editable installs; initialize() handles exactly those two. Any other string - which current hatchling versions never send - hits this ValueError. In practice it indicates an incompatible hatchling version, a custom build frontend calling hooks with its own version labels, or direct manual invocation of the hook.","triggerScenarios":"A newer/older hatchling release that changes the version-mode vocabulary passed to build hooks; a custom build script that instantiates LlmfitBinaryBuildHook and calls initialize() with an arbitrary string like 'sdist' or 'dev'; a fork renaming hatchling internals.","commonSituations":"Dependency drift after `uv lock` upgrades hatchling to a release with breaking hook-contract changes; teams wrapping hatchling with bespoke release tooling that passes non-standard version modes.","solutions":["Pin the hatchling version the project is developed against (the constraint in llmfit-python's build-system requirements) and relock.","Avoid invoking the hook manually; build through standard frontends: `uv build`, `uv sync`, `python -m build`, `pip install -e .`.","If you maintain a custom frontend, pass 'standard' for wheel builds and 'editable' for editable installs.","Report the hatchling version incompatibility upstream so the hook can accommodate the new mode."],"exampleFix":"# before\n# custom script calls the hook with its own label\nhook.initialize(version='sdist', build_data={})  # ValueError: Unknown version: 'sdist'\n\n# after\nhook.initialize(version='standard', build_data={'shared_scripts': {}, 'tag': '', 'pure_python': True})","handlingStrategy":"validation","validationCode":"import hatchling\nfrom packaging.version import Version\n\nassert Version(hatchling.__version__) < Version('2.0'), (\n    'llmfit build hook expects hatchling version modes standard/editable; '\n    f'got hatchling {hatchling.__version__}'\n)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Build only through standard frontends (uv build, uv sync, python -m build, pip) that pass 'standard'/'editable'.","Pin hatchling to the version range declared in llmfit-python's [build-system] and relock deliberately.","Do not call LlmfitBinaryBuildHook.initialize() from custom scripts; if you must, pass 'standard' or 'editable'.","Review hatchling changelogs for build-hook contract changes before upgrading."],"tags":["python","packaging","build","hatchling"],"backgroundTag":"unsupported-build-option","analyzedSha":"a9ac7ed91c1729cd93944bc1338e8313daaba8fa","analyzedAt":"2026-08-16T19:19:11.438Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}