Skip to content

CI cache pruning corrupts cache for other Python versions #8929

@nijel

Description

@nijel

We use multiple Python versions in one of our CI pipelines, but the uv cache is generated only for one of the Python versions. On subsequent runs when cache is used, the package build fails with:

Resolved 1 package in 107ms
error: Failed to prepare distributions
  Caused by: Failed to download and build `pycairo==1.27.0`
  Caused by: Attempted to re-extract the source distribution for `pycairo==1.27.0`, but the hashes didn't match. Run `uv cache clean` to clear the cache.

Clearing the cache indeed fixes the issue.

The issue does not exist without running uv cache prune --ci.

Reproduced with uv 0.4.29 and 0.5.0.

Reproducer:

#!/bin/sh

export UV_CACHE_DIR="$PWD/cache"

rm -rf "$UV_CACHE_DIR" .venv .venv-2 pyproject.toml uv.lock

uv init --name uv-cache-issue
uv add --python 3.13 "pycairo"

uv cache prune --ci

rm -rf .venv .venv-2

uv venv --python python3.11 .venv-2
. .venv-2/bin/activate
uv pip install "pycairo"

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcacheCaching of packages and metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions