astral-sh/uv · error · anyhow::Error

Could not find an index named `{name}`

Error message

Could not find an index named `{name}`

What it means

Error "Could not find an index named `{name}`" thrown in astral-sh/uv.

Source

Thrown at crates/uv-cli/src/lib.rs:1394

                let mut index = index.clone();
                // Keep relative paths anchored to their configuration file without marking them
                // as absolute when CLI settings are rebased or written back to a project.
                if let IndexUrl::Path(url) = index.url()
                    && !url.was_given_absolute()
                {
                    index.url = IndexUrl::from(VerbatimUrl::from_url(index.raw_url().clone()));
                }

                return Ok(Index {
                    default,
                    explicit: false,
                    origin: Some(Origin::Cli),
                    ..index
                });
            }

            if preview_enabled && !path_exists {
                return Err(anyhow!("Could not find an index named `{name}`"));
            }
        }

        Ok(Index {
            default,
            origin: Some(Origin::Cli),
            ..Index::from_str(name.as_ref())?
        })
    }
}

/// A potentially unresolved index.
#[expect(clippy::large_enum_variant)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum IndexArg {
    /// A usable index with a URL.
    Resolved(Index),
    /// An unresolved index specification.

View on GitHub (pinned to f1a42680ff)

When it happens

Trigger: Thrown at crates/uv-cli/src/lib.rs:1394 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/4c1362373216c4de. Report an issue: GitHub.