{"id":"cf2a66761bd4977d","repo":"python-poetry/poetry","slug":"downloaded-distributions-for-b-package-pretty-na","errorCode":null,"errorMessage":"Downloaded distributions for <b>{package.pretty_name} ({package.pretty_version})</> did not match any known checksums in your lock file.","messagePattern":"Downloaded distributions for <b>(.+?) \\((.+?)\\)</> did not match any known checksums in your lock file\\.","errorType":"exception","errorClass":"PoetryRuntimeError","httpStatus":null,"severity":"error","filePath":"src/poetry/installation/chooser.py","lineNumber":264,"sourceCode":"            messages = [\n                ConsoleMessage(\n                    \"<options=bold>Causes:</>\\n\"\n                    \"  - invalid or corrupt cache either during locking or installation\\n\"\n                    \"  - network interruptions or errors causing corrupted downloads\\n\\n\"\n                    \"<b>Solutions:</>\\n\"\n                    \"  1. Try running your command again using the <c1>--no-cache</> global option enabled.\\n\"\n                    \"  2. Try regenerating your lock file using (<c1>poetry lock --no-cache --regenerate</>).\\n\\n\"\n                    \"If any of those solutions worked, you will have to clear your caches using (<c1>poetry cache clear --all CACHE_NAME</>).\"\n                ),\n                ConsoleMessage(\n                    f\"Poetry retrieved the following links:\\n\"\n                    f\"{link_hashes}\\n\\n\"\n                    f\"The lockfile contained only the following hashes:\\n\"\n                    f\"{known_hashes}\",\n                    debug=True,\n                ),\n            ]\n            raise PoetryRuntimeError(reason, messages)\n\n        return selected_links\n\n    def _sort_key(\n        self, package: Package, link: Link\n    ) -> tuple[int, int, int, Version, tuple[Any, ...], int]:\n        \"\"\"\n        Function to pass as the `key` argument to a call to sorted() to sort\n        InstallationCandidates by preference.\n        Returns a tuple such that tuples sorting as greater using Python's\n        default comparison operator are more preferred.\n        The preference is as follows:\n        First and foremost, candidates with allowed (matching) hashes are\n        always preferred over candidates without matching hashes. This is\n        because e.g. if the only candidate with an allowed hash is yanked,\n        we still want to use that candidate.\n        Second, excepting hash considerations, candidates that have been\n        yanked (in the sense of PEP 592) are always less preferred than","sourceCodeStart":246,"sourceCodeEnd":282,"githubUrl":"https://github.com/python-poetry/poetry/blob/92b74dcfe348d0e01e14d40d6c1fa47a4ee04a54/src/poetry/installation/chooser.py#L246-L282","documentation":"Raised by Chooser._get_links at src/poetry/installation/chooser.py:242-264 as PoetryRuntimeError when the repository returned links for the package but, after filtering against locked hashes, zero links remained. The message lists causes (corrupt cache, network errors) and the skipped vs known hashes. This is a checksum/integrity mismatch between the repository and poetry.lock.","triggerScenarios":"Install/update with a populated poetry.lock: for every link found in the repo, none of its hashes (or computed sha256 for HTTPRepository) appear in the lock file's package.files hashes. Happens after a mirror was republished, a cache served a stale/ corrupt file, or the lock file is from an unrelated set of artifacts.","commonSituations":"Corporate PyPI mirror desynced from upstream; poetry's HTTP cache poisoned by an interrupted download; a lock file committed from a different index than the one currently configured; package yanked-and-reuploaded under the same version.","solutions":["Run `poetry lock --no-cache --regenerate` to rebuild the lock file from current repository hashes.","Retry the install with `--no-cache` to bypass a poisoned cache: `poetry install --no-cache`.","Clear the offending cache: `poetry cache clear --all <CACHE_NAME>` (list with `poetry cache list`).","Verify the configured repository still serves the exact files (a mirror change is a common root cause)."],"exampleFix":"# before\n$ poetry install\nRuntimeError: ... did not match any known checksums ...\n\n# after\n$ poetry lock --no-cache --regenerate\n$ poetry install","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"from poetry.installation.exceptions import PoetryRuntimeError\n\ntry:\n    installer.run()\nexcept PoetryRuntimeError as e:\n    if 'did not match any known checksums' in str(e):\n        # regenerate and retry once\n        run('poetry', 'lock', '--no-cache', '--regenerate', check=True)\n        installer.run()\n    else:\n        raise","preventionTips":["Keep poetry.lock committed and in sync with pyproject.toml.","Periodically clear caches; pin index URLs so artifacts don't drift.","Avoid mirroring indexes that rewrite artifacts without stable hashes."],"tags":["checksum","integrity","lock-file","cache","installation"],"analyzedSha":"92b74dcfe348d0e01e14d40d6c1fa47a4ee04a54","analyzedAt":"2026-08-04T20:33:34.072Z","schemaVersion":2}