astral-sh/uv · error · anyhow::Error
The `--default` flag cannot be used with multiple targets
Error message
The `--default` flag cannot be used with multiple targets
What it means
Error "The `--default` flag cannot be used with multiple targets" thrown in astral-sh/uv.
Source
Thrown at crates/uv/src/commands/python/install.rs:325
concurrency: &Concurrency,
preview: Preview,
printer: Printer,
) -> Result<ExitStatus> {
let start = std::time::Instant::now();
// TODO(zanieb): We should consider marking the Python installation as the default when
// `--default` is used. It's not clear how this overlaps with a global Python pin, but I'd be
// surprised if `uv python find` returned the "newest" Python version rather than the one I just
// installed with the `--default` flag.
if default && !preview.is_enabled(PreviewFeature::PythonInstallDefault) {
warn_user!(
"The `--default` option is experimental and may change without warning. Pass `--preview-features {}` to disable this warning",
PreviewFeature::PythonInstallDefault
);
}
if default && targets.len() > 1 {
anyhow::bail!("The `--default` flag cannot be used with multiple targets");
}
// Read the existing installations, lock the directory for the duration
let installations = ManagedPythonInstallations::from_settings(install_dir.clone())?.init()?;
let installations_dir = installations.root();
let scratch_dir = installations.scratch();
let _lock = installations.lock().await?;
let existing_installations: Vec<_> = installations
.find_all()?
.inspect(|installation| trace!("Found existing installation {}", installation.key()))
.collect();
// Resolve the requests
let mut is_default_install = false;
let mut is_unspecified_upgrade = false;
let retry_policy = client_builder.retry_policy();
let download_list = ManagedPythonDownloadList::new(
&client_builder,View on GitHub (pinned to f1a42680ff)
When it happens
Trigger: Thrown at crates/uv/src/commands/python/install.rs:325 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of astral-sh/uv@f1a42680ff (2026-08-16).
Data as JSON: /api/errors/0ee0b7a0f0c97946.
Report an issue: GitHub.