diff --git a/crates/uv-resolver/src/lock/mod.rs b/crates/uv-resolver/src/lock/mod.rs index eea08f668..f546c95b0 100644 --- a/crates/uv-resolver/src/lock/mod.rs +++ b/crates/uv-resolver/src/lock/mod.rs @@ -2877,6 +2877,8 @@ impl PackageWire { if version != &wheel.filename.version { return Err(LockError::from(LockErrorKind::InconsistentVersions { name: self.id.name, + version: version.clone(), + wheel: wheel.clone(), })); } } @@ -5171,10 +5173,14 @@ enum LockErrorKind { }, /// A package has inconsistent versions in a single entry // Using name instead of id since the version in the id is part of the conflict. - #[error("Locked package and file versions are inconsistent for `{name}`", name = name.cyan())] + #[error("The entry for package `{name}` v{version} has wheel `{wheel_filename}` with inconsistent version: v{wheel_version} ", name = name.cyan(), wheel_filename = wheel.filename, wheel_version = wheel.filename.version)] InconsistentVersions { /// The name of the package with the inconsistent entry. name: PackageName, + /// The version of the package with the inconsistent entry. + version: Version, + /// The wheel with the inconsistent version. + wheel: Wheel, }, #[error( "Found conflicting extras `{package1}[{extra1}]` \ diff --git a/crates/uv/tests/it/sync.rs b/crates/uv/tests/it/sync.rs index 5d71de02c..0a81b9f60 100644 --- a/crates/uv/tests/it/sync.rs +++ b/crates/uv/tests/it/sync.rs @@ -8549,7 +8549,7 @@ fn locked_version_coherence() -> Result<()> { ----- stderr ----- error: Failed to parse `uv.lock` - Caused by: Locked package and file versions are inconsistent for `iniconfig` + Caused by: The entry for package `iniconfig` v1.0.0 has wheel `iniconfig-2.0.0-py3-none-any.whl` with inconsistent version: v2.0.0 "); // Without `--locked`, we could fail or recreate the lockfile, currently, we fail. @@ -8560,7 +8560,7 @@ fn locked_version_coherence() -> Result<()> { ----- stderr ----- error: Failed to parse `uv.lock` - Caused by: Locked package and file versions are inconsistent for `iniconfig` + Caused by: The entry for package `iniconfig` v1.0.0 has wheel `iniconfig-2.0.0-py3-none-any.whl` with inconsistent version: v2.0.0 "); Ok(())