astral-sh/uv · error · anyhow::Error
Failed to parse version specifier `{target_version}`: explic
Error message
Failed to parse version specifier `{target_version}`: explicit versions must include an exact major.minor.patch release What it means
Error "Failed to parse version specifier `{target_version}`: explicit versions must include an exact major.minor.patch release" thrown in astral-sh/uv.
Source
Thrown at crates/uv/src/commands/self_update.rs:316
/// Parse an explicit `uv self update` target version for the official public case.
///
/// To preserve existing tag-based behavior, only exact `major.minor.patch` release versions are
/// accepted. Inputs that normalize to a different version string, such as `0.10` or `v0.10.0`,
/// are rejected instead of being silently rewritten.
fn official_target_version_specifiers(
target_version: Option<&str>,
) -> Result<Option<VersionSpecifiers>> {
let Some(target_version) = target_version else {
return Ok(None);
};
let pep440_version = Pep440Version::from_str(target_version)
.with_context(|| format!("Failed to parse version specifier `{target_version}`"))?;
if pep440_version.to_string() != target_version || pep440_version.release().len() < 3 {
warn!(
"Rejecting explicit self-update version specifier `{target_version}` after parsing it as `{pep440_version}`"
);
anyhow::bail!(
"Failed to parse version specifier `{target_version}`: explicit versions must include an exact major.minor.patch release"
);
}
Ok(Some(VersionSpecifiers::from(
VersionSpecifier::equals_version(pep440_version),
)))
}
fn is_update_needed(
current_version: &Pep440Version,
target_version: &Pep440Version,
has_target_version: bool,
) -> bool {
if has_target_version {
current_version != target_version
} else {
current_version < target_versionView on GitHub (pinned to f1a42680ff)
When it happens
Trigger: Thrown at crates/uv/src/commands/self_update.rs:316 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
AI-assisted analysis of astral-sh/uv@f1a42680ff (2026-08-16).
Data as JSON: /api/errors/4b5b0da3da5f5974.
Report an issue: GitHub.