{"record":{"id":"9fd0c6f5f71ce35f","repo":"AlexsJones/llmfit","slug":"binary-not-found-at-bin-path-the-binary-selecti","errorCode":null,"errorMessage":"Binary not found at {bin_path}. The binary selection logic selected a file that does not exist.","messagePattern":"Binary not found at (.+?)\\. The binary selection logic selected a file that does not exist\\.","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"llmfit-python/hatch_build.py","lineNumber":197,"sourceCode":"\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}\"\n        build_data[\"pure_python\"] = False\n","sourceCodeStart":179,"sourceCodeEnd":213,"githubUrl":"https://github.com/AlexsJones/llmfit/blob/a9ac7ed91c1729cd93944bc1338e8313daaba8fa/llmfit-python/hatch_build.py#L179-L213","documentation":"A defensive re-check in initialize(): both selection helpers (_find_local_binary and _find_binary_for_target) already verify the file exists and raise their own errors, so this FileNotFoundError can only fire if the chosen path stopped being a file between selection and this check - a race such as a concurrent cargo clean, the artifact living on a flaky mount, antivirus quarantining the fresh binary on Windows, or a broken symlink at one of the candidate paths.","triggerScenarios":"Two build jobs sharing one target/ directory where one runs `cargo clean` while the other is mid-`uv build`; a symlinked target/debug/llmfit pointing at a deleted file (is_file() follows symlinks); Windows Defender removing the just-built unsigned exe between cargo finishing and the hook's stat call.","commonSituations":"Parallel CI jobs on a shared workspace or network volume; developer running `make clean` in another terminal during a build; security software interfering on Windows runners.","solutions":["Re-run the build after the concurrent operation finishes; serialize cargo clean and uv build steps.","Verify the printed path manually (`ls -l <bin_path>`) - if it is a dangling symlink, delete it and rebuild.","Give each CI job its own workspace/target directory instead of sharing one.","On Windows, add an exclusion for the repo's target/ directory in antivirus, or mark the pipeline to tolerate rescans."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"from pathlib import Path\n\nbin_path = Path('target') / 'x86_64-unknown-linux-gnu' / 'release' / 'llmfit'\nif not (bin_path.is_file() and not bin_path.is_symlink()):\n    raise SystemExit(f'{bin_path} missing or a symlink; rebuild with cargo build --release --target x86_64-unknown-linux-gnu')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Serialize cargo clean and uv build; never share one target/ directory between concurrent jobs.","Avoid symlinking into target/; keep real cargo artifacts at the scanned paths.","On Windows runners, exclude the repo from antivirus rescans that quarantine fresh exes.","Re-run the build once a suspected race clears; a persistent hit means a real selection-logic bug to report upstream."],"tags":["python","packaging","build","race-condition","filesystem"],"backgroundTag":"missing-build-artifact","analyzedSha":"a9ac7ed91c1729cd93944bc1338e8313daaba8fa","analyzedAt":"2026-08-16T19:19:11.438Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}