astral-sh/uv · error
Invalid file path in index URL: {url}
Error message
Invalid file path in index URL: {url} What it means
Error "Invalid file path in index URL: {url}" thrown in astral-sh/uv.
Source
Thrown at crates/uv/src/commands/project/add.rs:682
match &dependency_type {
DependencyType::Group(group) => {
toml.ensure_dependency_group(group)?;
}
DependencyType::Optional(extra) => {
toml.ensure_optional_dependency(extra)?;
}
_ => {}
}
}
// Validate any indexes that were provided on the command-line to ensure
// they point to existing non-empty directories when using path URLs.
let mut valid_indexes = Vec::with_capacity(indexes.len());
for index in indexes {
if let IndexUrl::Path(url) = &index.url {
let path = url
.to_file_path()
.map_err(|()| anyhow::anyhow!("Invalid file path in index URL: {url}"))?;
if !path.is_dir() {
bail!("Directory not found for index: {url}");
}
if fs_err::read_dir(&path)?.next().is_none() {
warn_user_once!("Index directory `{url}` is empty, skipping");
continue;
}
}
valid_indexes.push(index);
}
let indexes = valid_indexes;
// Add any indexes that were provided on the command-line, in priority order.
if !raw {
let root_dir = match &target {
AddTarget::Script(script, _) => {
script.path.parent().expect("script path has no parent")
}View on GitHub (pinned to f1a42680ff)
When it happens
Trigger: Thrown at crates/uv/src/commands/project/add.rs:682 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/1ed5c296f6357d5b.
Report an issue: GitHub.